Facebook iOS SDK not returning to my application

I am trying to implement the new oKuth2 facebook SDK in my application, but I can’t understand for life how I should return to my application after login / authentication.

My goal is to post a message on the users wall.

I am currently starting the login procedure:

-(void)tryFBlogin { NSString *appId = @"113142482******"; NSArray *permissions = [[NSArray arrayWithObjects:@"publish_stream",nil] retain]; TheAppDelegate *theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication]delegate]; //Asking for permission theAppDelegate = (TheAppDelegate *)[[UIApplication sharedApplication] delegate]; theAppDelegate.facebook = [[Facebook alloc] initWithAppId:appId andDelegate:self]; Facebook *fb = [theAppDelegate facebook]; [fb authorize:permissions]; } 

which opens the Safari browser. If I have already logged in and received the permission of the application, this will tell me about it, and I have an OKay button for pressing.

When I click OKay, I get a warning that safari cannot open the page. I acknowledge the warning and remain staring at the empty safari window.

If I log out of facebook, I will be presented with a login screen, which I fill out, and then will be presented in the same way as above.

I understand that I have not yet implemented the publish command, but I do not know where / when this should be implemented.

I have this delegate method, but it seems to never be called

 - (void)fbDidLogin { NSLog(@"fbDidLogin"); } 

This is the code I expect somewhere somewhere:

 NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: kAppId, @"113142482******", facebookUrl, @"link", @"http://www.domain.com", @"picture", @"My Message", @"name", @"Caption text!", @"caption", @"Message text.", @"message", nil]; [facebook dialog:@"feed" andParams:params andDelegate:self]; 

I also have the following methods in the main AppDelegate application:

 -(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url{ [facebook handleOpenURL:url]; return YES; } 

Any help / suggestions would be greatly appreciated.

thanks

Mark

+7
source share
3 answers

I had the same problem. To clarify some other answers, here is how I fixed the problem for my iPhone application in Xcode 4.2:

 .plist file "URL types" "Item 0" "URL Schemes" "Item 0" "fb21593853845xxxx" 
+25
source

Arg, it is better to open .plist as a source of code, you should see:

 <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb38*******</string> </array> </dict> </array> 
0
source

You must write your AppID for your .plist

-one
source

All Articles