Many app crashes
GorkaMM opened this issue · comments
I'm getting many crashes from EasyFacebook when users try to sign in with Facebook. This is the exception thrown and the backtrace:
Fatal Exception: com.facebook.sdk:InvalidOperationException
FBSession: It is not valid to reauthorize while a previous reauthorize call has not yet completed.
Thread : Fatal Exception: com.facebook.sdk:InvalidOperationException
0 CoreFoundation 0x219ae5f7 __exceptionPreprocess + 126
1 libobjc.A.dylib 0x2f462c77 objc_exception_throw + 38
2 CoreFoundation 0x219ae305 -[NSException init]
3 upclose 0x0024f52d -[FBSession reauthorizeWithPermissions:isRead:behavior:defaultAudience:completionHandler:] (FBSession.m:1688)
4 upclose 0x0024be3f -[FBSession requestNewPublishPermissions:defaultAudience:completionHandler:] (FBSession.m:435)
5 upclose 0x0021317f -[EasyFacebook requestPublishPermissionsWithFacebookSDK:error:] (EasyFacebook.m:390)
6 libdispatch.dylib 0x2f9c3423 _dispatch_call_block_and_release + 10
7 libdispatch.dylib 0x2f9c340f _dispatch_client_callout + 22
8 libdispatch.dylib 0x2f9ce1b5 _dispatch_main_queue_callback_4CF$VARIANT$mp + 712
9 CoreFoundation 0x21974631 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x21972d51 __CFRunLoopRun + 1512
11 CoreFoundation 0x218bfb31 CFRunLoopRunSpecific + 476
12 CoreFoundation 0x218bf943 CFRunLoopRunInMode + 106
13 GraphicsServices 0x28c47051 GSEventRunModal + 136
14 UIKit 0x24eb56f1 UIApplicationMain + 1440
15 upclose 0x0009527f main (main.m:16)
16 libdyld.dylib 0x2f9feaaf <redacted> + 2
It looks the error comes from the Facebook SDK, but based on the trace, EasyFacebook seems to be provoking it. Could you please put some light on this?
Any news about this?
Sorry, busy month. I see where the error is coming from. Are you using HEAD or the latest release?
Thank you for the response! I'm using the latest release, the 0.1.2.
On 16 Feb 2015, at 21:28, Baris Sencan notifications@github.com wrote:
Sorry, busy month. I see where the error is coming from. Are you using HEAD or the latest release?
—
Reply to this email directly or view it on GitHub.
I see. Could you possibly show me where and how you use EasyFacebook library functions?
Sure! I'm using it in this simple way, @isair:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[EasyFacebook sharedInstance].facebookAppID = @"app_id";
[EasyFacebook sharedInstance].facebookReadPermissions = @[@"things"];
[EasyFacebook sharedInstance].facebookPublishPermissions = @[@"things"];
// More non-related stuff
}
...
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
}
And my own implementation:
- (void)requestAuth {
[[EasyFacebook sharedInstance] openSession:^(NSString *sessionToken) {
if (sessionToken == nil) {
// Handle error
return;
}
[[EasyFacebook sharedInstance] requestPublishPermissions:^(NSString *sessionWithPublishPermissionsToken) {
// Handle success
} error:^(NSError *error) {
// Handle error
}];
} error:^(NSError *error) {
// Handle error
}];
}
This requestAuth
method is called when a Sign in with Facebook button is pressed by the user in a login screen.
I believe the problem is caused by your usage of requestPublishPermissions inside the openSession callback. Besides, for auth you just need read permissions. Publish permissions are generally asked just before doing an action that needs them.
I will move it outside then and I'll be aware of future crashes to confirm it's really fixed.
Thank you!