Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook SDK 3.1 - com.facebook.sdk Error 5 when authenticating with [facebook authorize:permissions]

When authenticating with following authorization method i'm getting com.facebook.sdk error 5 with startWithGraphPath and startForMeWithCompletionHandler but not with requestWithGraphPath. I'm succesfully getting token (printing in didLogin) and getting anything which i want with requestwithGraphPath but i'm unable to get work with other methods. If anybody encountered with same issue or something similar or has any idea, i'd be happy if you share it.

Thanks

Method:

NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_likes",@"offline_access",@"read_stream",@"publish_stream",nil];
[_facebook authorize:permissions];
like image 461
Atahan Bozkurt Avatar asked Dec 15 '22 17:12

Atahan Bozkurt


1 Answers

The startWithGraphPath and other start* methods are likely not picking up an active session. Those methods are relying on an active session being set. See:

https://developers.facebook.com/docs/reference/ios/3.1/class/FBRequestConnection#startWithGraphPath%3AcompletionHandler%3A

"The request uses the active session represented by [FBSession activeSession]."

So you'll have to do something like this:

[FBSession setActiveSession:session];

Where session is an FBSession that you had previously set up.

like image 175
C Abernathy Avatar answered Jan 02 '23 04:01

C Abernathy