I am having trouble figuring out how to log a user into my app. [FBSDKAccessToken currentAccessToken]
is nil, so I am calling:
[[[FBSDKLoginManager alloc] init] logInWithPublishPermissions:@[@"publish_actions"] handler:…];
as per the included sample project. This switches to the Facebook app, but the message says "You have already authorized App Name.". I click OK and it goes back into the app, but grantedPermissions
and declinedPermissions
are both nil
on the result, and isCancelled
is YES
. [FBSDKAccessToken currentAccessToken]
is still nil
.
I can't figure out how I'm supposed to get currentAccessToken
to be filled in. It seems to me the call to logInWithPublishPermissions
should do that, but it isn't.
You should try adding in your AppDelegate didFinishLaunchingWithOptions :
return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
This would get u [FBSDKAccessToken currentAccessToken]
when user is logged in.
and
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; }
If this method is not present into AppDelegate then it results into cancelled state.
Refer to : https://developers.facebook.com/docs/ios/getting-started#startcoding
This can happen when your Facebook App doesn't have "publish_actions" permission, or you're not using a test user.
On Facebook, go to manage your app, then make sure that the Facebook user you're using is defined under "Roles" as an admin or tester.
If it's not a test user or admin - Facebook will require "publish_actions" permission to be reviewed and approved before allowing your app to use it, until then you'll receive a "isCancelled=YES" result.
After testing your app with this permission, it is possible to submit this permission for review, you'll need to upload a binary that demonstrates usage of this permission with exact details on how to use it. After it's approved, you'll be able to use it with non-test Facebook users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With