Reputation: 217
Am using the last Facebook SDK for IOS but I always get this error : The operation couldn’t be completed. (com.facebook.sdk error 5.) Please do you have any idea about that ? Thank You.
[[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
NSLog(@"%@",user.name);
//self.emailLabel.text = [user objectForKey:@"email"];
} else {
NSLog(@"%@",error.localizedDescription);
}
}];
Upvotes: 1
Views: 6632
Reputation: 1001
add the following code in AppDelegate File.
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBAppEvents activateApp];
[FBAppCall handleDidBecomeActive];
[FBSession openActiveSessionWithAllowLoginUI:NO];
}
The graph API calls used to work when I used to do the login & then make any calls. But when I used to re-open the app, the graph API call to get the photos used to fail with error code 5. So, after looking into FBSession class, I found that [FBSession openActiveSessionWithAllowLoginUI:NO]; call would make the session active. And thus the issue got fixed.
Upvotes: 1
Reputation: 217
I have solved this kind of issue by doing this :
[FBSession setActiveSession:session];
Thank you !
Upvotes: 0