IOS 9 not logged in on Facebook?

I am using Xcode 7.0, testing on iOS 9.0.2 and using the Facebook SDK 4.7.0. Code = 308 "(null)" The problem occurs in iOS 9. I use objective-c code in my project. how to solve it? Below is my code.

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [login logInWithReadPermissions:@[@"public_profile",@"email", @"user_friends"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error){ if ([FBSDKAccessToken currentAccessToken]) { startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { if (!error) { } }]; } }]; 
+6
source share
5 answers

iOS9.2.1

This fixes my 308 issues

Open as β€œsource code”, the plist file, find LSApplicationQueriesSchemes, then add / modify as needed.

 <key>LSApplicationQueriesSchemes</key> <array> <string>fbauth2</string> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbshareextension</string> </array> 
+4
source

Try this code:

  FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; login.loginBehavior = FBSDKLoginBehaviorWeb; [login logInWithReadPermissions:@[@"email"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { // Process error } else if (result.isCancelled) { // Handle cancellations } else { if ([result.grantedPermissions containsObject:@"email"]) { NSLog(@"result is:%@",result); [self fetchUserInfo]; [login logOut]; } } }]; 
+2
source

I think this is due to the new iOS 9 URL handling scheme

You need to add trusted URLs to plist under LSApplicationQueriesSchemes

Question related to us

0
source
  - (IBAction)facebookClick:(id)sender { FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [login logOut]; login = [[FBSDKLoginManager alloc] init]; login.loginBehavior = FBSDKLoginBehaviorWeb; [login logInWithReadPermissions:@[@"email"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { NSLog(@"Process error"); // [login logOut]; } else if (result.isCancelled) { NSLog(@"Cancelled"); // [login logOut]; } else { NSLog(@"Logged in"); [self getUserInformation]; } }]; } 
0
source

For iOS 10 with xCode 8

Set ON your project Bracket Chain Sharing on the Features tab. target

0
source

All Articles