I am using xcode8 and I have enabled all but its not working
1)Enabled key chain in app.
2)InAppdelegate.m
didFinishLaunching method
[[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
I have a custom button in my viewcontroller file for "login with FB" the button action is
-(void)signInWithFaceBookAction {
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithReadPermissions:@[@"public_profile", @"email", @"user_friends"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
//TODO: process error or result
NSLog(@"Results :%@ --- Error:%@",result,error.description);
NSLog(@"Token:%@ -- isCancelled:%d -- Granted Permissions:%@ -- Declined permissions:%@",result.token,result.isCancelled,result.grantedPermissions,result.declinedPermissions);
NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
[parameters setValue:@"id,name,email" forKey:@"fields"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:parameters]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSLog(@"Result :%@",result);
NSLog(@"Error: %@",error.localizedDescription);
}];
}];
}