本文介绍了facebook sdk在应用程序委托中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我复制错误的方法。所以这是我登录的代码:

Here's how I replicate the bug. So here's the code I have for logging in:

@IBAction func FBLoginAction(_ sender: AnyObject) {
    fbLoginManager.loginBehavior = FBSDKLoginBehavior.browser
    fbLoginManager.logIn(withReadPermissions: ["public_profile", "email", "user_friends"], from: self) { (result, error) -> Void in
        if (error != nil) {
            return
        }
    }
 }

如果我登录两次,然后再次运行该应用程序,此行将在appdelegate中崩溃。

If i login twice, and then run the app again, this line crashes in the appdelegate.

    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

如果我只登录一次,再次运行应用程序,则不会发生崩溃。崩溃的完整堆栈如下:

If i only log in once, and run the app again, no crash happens. The full stack for the crash is the following:

***首先抛出调用堆栈: (0 CoreFoundation 0x00000001085e634b exceptionPreprocess + 171 1 libobjc.A.dylib

0x0000000107c2a21e objc_exception_throw + 48 2 CoreFoundation

0x0000000108655f34 - [NSObject(NSObject)doesNotRecognizeSelector:] +
132 3 CoreFoundation 0x000000010856bc15
___ forwarding _
+ 1013 4 CoreFoundation 0x00000001085 6b798 _CF_forwarding_prep_0 + 120 5 FBSDKCoreKit

0x000000010700aa5a - [FBSDKAccessTokenCacheV4 fetchAccessToken] + 202
6 FBSDKCoreKit 0x000000010700902c
- [FBSDKAccessTokenCache fetchAccessToken] + 92 7 FBSDKCoreKit 0x0000000107017d2d - [FBSDKApplicationDelegate
application中:didFinishLaunchingWithOptions:] + 125 8持久性结果,
0x000000010572bcb7
_TFC11Persistence11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb
+ 727 9持久0x000000010572cfb4 _TToFC11Persistence11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb
+ 180 10的UIKit 0x00000001091110be - [UIApplication的_handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290 11 UIKit 0x0000000109112a43
- [UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236 12 UIKit 0x0000000109118de9
- [UIApplication _runWithMainScene:transitionContext:completion:] + 1731 13 UIKit 0x0000000109115f69
- [UIApplication workspaceDidEndTransaction:] + 188 14 FrontBoardServices 0x000000010d698723
FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 15 FrontBoardServices 0x000000010d69859c
- [FBSSerialQueue _performNext] + 189 16 FrontBoardServices 0x000000010d698925 - [FBSSerialQueue _performNextFromRunLoopSource] +
45 17 CoreFoundation 0x000000010858b311
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 18 CoreFoundation 0x000000010857059c
__CFRunLoo pDoSources0 + 556 19 CoreFoundation 0x000000010856fa86 __CFRunLoopRun + 918 20 CoreFoundation

0x000000010856f494 CFRunLoopRunSpecific + 420 21 UIKit

0x00000001091147e6 - [UIApplication _run] + 434 22 UIKit

0x000000010911a964 UIApplicationMain + 159 23 Persistence

0x000000010572d97f main + 111 24 libdyld.dylib

0x000000010b3a368d start + 1)libc ++ abi.dylib:以
终止$ NSException类型的未捕获异常

*** First throw call stack: ( 0 CoreFoundation 0x00000001085e634b exceptionPreprocess + 171 1 libobjc.A.dylib
0x0000000107c2a21e objc_exception_throw + 48 2 CoreFoundation
0x0000000108655f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x000000010856bc15 ___forwarding_
+ 1013 4 CoreFoundation 0x000000010856b798 _CF_forwarding_prep_0 + 120 5 FBSDKCoreKit
0x000000010700aa5a -[FBSDKAccessTokenCacheV4 fetchAccessToken] + 202 6 FBSDKCoreKit 0x000000010700902c -[FBSDKAccessTokenCache fetchAccessToken] + 92 7 FBSDKCoreKit 0x0000000107017d2d -[FBSDKApplicationDelegate application:didFinishLaunchingWithOptions:] + 125 8 Persistence
0x000000010572bcb7 _TFC11Persistence11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 727 9 Persistence 0x000000010572cfb4 _TToFC11Persistence11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180 10 UIKit 0x00000001091110be -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290 11 UIKit 0x0000000109112a43 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236 12 UIKit 0x0000000109118de9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731 13 UIKit 0x0000000109115f69 -[UIApplication workspaceDidEndTransaction:] + 188 14 FrontBoardServices 0x000000010d698723 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 15 FrontBoardServices 0x000000010d69859c -[FBSSerialQueue _performNext] + 189 16 FrontBoardServices 0x000000010d698925 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 17 CoreFoundation 0x000000010858b311 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 18 CoreFoundation 0x000000010857059c __CFRunLoopDoSources0 + 556 19 CoreFoundation 0x000000010856fa86 __CFRunLoopRun + 918 20 CoreFoundation
0x000000010856f494 CFRunLoopRunSpecific + 420 21 UIKit
0x00000001091147e6 -[UIApplication _run] + 434 22 UIKit
0x000000010911a964 UIApplicationMain + 159 23 Persistence
0x000000010572d97f main + 111 24 libdyld.dylib
0x000000010b3a368d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException


推荐答案

我恢复到Facebook SDK的4.17.0版本,我不再受到崩溃。

I reverted to version 4.17.0 of the Facebook SDK and I no longer get the crash.

这篇关于facebook sdk在应用程序委托中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 05:00