使用Facebook sdk登录时应用程序崩溃

时间:2013-03-19 18:59:46

标签: ios objective-c facebook facebook-ios-sdk

当用户使用Facebook登录时,我试图找出崩溃的ios应用程序。每次都不会重现该错误,我只有很少的关于此问题的报告和一个崩溃日志:

Process:         Facebook [2417]
Path:            /var/mobile/Applications/ADF140E7-A40C-40A2-BC99-7E558C528F97/Facebook.app/Facebook
Identifier:      Facebook

Exception Type:  EXC_CRASH (SIGBUS)

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3b7c9f04 semaphore_wait_trap + 8
1   libdispatch.dylib               0x3b6f92fc _dispatch_thread_semaphore_wait$VARIANT$mp + 8
2   libdispatch.dylib               0x3b6f787c _dispatch_barrier_sync_f_slow + 96
3   QuartzCore                      0x351829d2 CABackingStoreGetFrontTexture(CABackingStore*) + 50
4   QuartzCore                      0x35198012 CABackingStorePrepareFrontTexture + 38
5   QuartzCore                      0x35175b24 CA::Layer::prepare_commit(CA::Transaction*) + 428
6   QuartzCore                      0x35175246 CA::Context::commit_transaction(CA::Transaction*) + 242
7   QuartzCore                      0x3517504c CA::Transaction::commit() + 312
8   UIKit                           0x3543a0ce -[UIApplication _reportAppLaunchFinished] + 38
9   UIKit                           0x3556ffee -[UIApplication _handleApplicationResumeEvent:] + 1358
10  UIKit                           0x353c7d54 -[UIApplication handleEvent:withNewEvent:] + 1288
11  UIKit                           0x353c76c8 -[UIApplication sendEvent:] + 68
12  Facebook                        0x004a4b3c 0x1d000 + 4750140
13  UIKit                           0x353c7116 _UIApplicationHandleEvent + 6150
14  GraphicsServices                0x370dd5a0 _PurpleEventCallback + 588
15  GraphicsServices                0x370dd1ce PurpleEventCallback + 30
16  CoreFoundation                  0x33594170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
17  CoreFoundation                  0x33594112 __CFRunLoopDoSource1 + 134
18  CoreFoundation                  0x33592f94 __CFRunLoopRun + 1380
19  CoreFoundation                  0x33505eb8 CFRunLoopRunSpecific + 352
20  CoreFoundation                  0x33505d44 CFRunLoopRunInMode + 100
21  GraphicsServices                0x370dc2e6 GSEventRunModal + 70
22  UIKit                           0x3541b2fc UIApplicationMain + 1116
23  Facebook                        0x0001fbd0 0x1d000 + 11216
24  Facebook                        0x0001fb94 0x1d000 + 11156

我已将ShareKit库与子库中更新的Facebook版本集成,但我将Facebook.h导入ApplicationDelegate类,并通过http://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/authenticate/

中的步骤将其直接用于授权

请告诉我在崩溃日志中查找问题的方法是什么?

ApplicationDelegate类包含:

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    ....
    [FBSession.activeSession handleDidBecomeActive];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    ....  
    [FBSession.activeSession close];
}


/*
 * If we have a valid session at the time of openURL call, we handle
 * Facebook transitions by passing the url argument to handleOpenURL
 */
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    [ProgressHUD displayProcessingIndicator];

    // attempt to extract a token from the url
    return [FBSession.activeSession handleOpenURL:url];
}

/*
 * Callback for session changes.
 */
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
    switch (state) {
        case FBSessionStateOpen:
            if (!error) {
                // We have a valid session
            }
            break;
        case FBSessionStateClosed:
        case FBSessionStateClosedLoginFailed:    
            [FBSession.activeSession closeAndClearTokenInformation];
            break;
        default:
            break;
    }

    [[NSNotificationCenter defaultCenter] postNotificationName:@"FacebookSessionStateChangeNotification"
                                                        object:session];

    if (error) {
        [ProgressHUD hideIndicator];
    }
}

/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (void)openFacebookSession
{
    // To using the internal ios6 integration, call openActiveSessionWithReadPermissions method
    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    [FBSession openActiveSessionWithPermissions:[NSArray arrayWithObject:@"email"]
                                   allowLoginUI:YES
                              completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
                                  [self sessionStateChanged:session state:state error:error];
                              }];
    #pragma GCC diagnostic warning "-Wdeprecated-declarations"
}

- (void)closeFacebookSession
{
    if (FBSession.activeSession.isOpen) {
        [FBSession.activeSession closeAndClearTokenInformation];
    }
}

非常感谢。

0 个答案:

没有答案