在libswiftCore.dylib _assertionFailed崩溃,不知道是什么导致了这一点

时间:2017-02-28 09:32:22

标签: ios realm

好的,所以我理解这个问题有点宽泛,但我不知道如何继续。

所以这就是我从面料看起来崩溃的原因(我无法重现这一点,但是我遇到了很多这样的崩溃事件)

Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x101085cb8 _assertionFailed(StaticString, String, StaticString, UInt, flags : UInt32) -> Never (__hidden#16085_:167)
1  libswiftCore.dylib             0x1010a5a70 _hidden#1062_ + 504
2  libswiftCore.dylib             0x1010a5878 swift_errorInMain + 26
3  MYAPPPPPP                      0x10006da44 specialized static FFBaseApiService.accessTokenGetString.getter (FFBaseApiService.swift)
4  libdispatch.dylib              0x191a9a1bc _dispatch_client_callout + 16
5  libdispatch.dylib              0x191a9afb0 dispatch_once_f + 56
6  MYAPPPPPP                      0x100105208 specialized FFAppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [UIApplicationLaunchOptionsKey : Any]?) -> Bool (FFAppDelegate.swift:62)
7  MYAPPPPPP                      0x100101b70 @objc FFAppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [UIApplicationLaunchOptionsKey : Any]?) -> Bool (FFAppDelegate.swift)
8  UIKit                          0x198b386a4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
9  UIKit                          0x198d48a98 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3524
10 UIKit                          0x198d4e808 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1656
11 UIKit                          0x198d63104 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3139 + 48
12 UIKit                          0x198d4b7ec -[UIApplication workspaceDidEndTransaction:] + 168
13 FrontBoardServices             0x1947e792c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
14 FrontBoardServices             0x1947e7798 -[FBSSerialQueue _performNext] + 176
15 FrontBoardServices             0x1947e7b40 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
16 CoreFoundation                 0x192bbeb5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
17 CoreFoundation                 0x192bbe4a4 __CFRunLoopDoSources0 + 524
18 CoreFoundation                 0x192bbc0a4 __CFRunLoopRun + 804
19 CoreFoundation                 0x192aea2b8 CFRunLoopRunSpecific + 444
20 UIKit                          0x198b317b0 -[UIApplication _run] + 608
21 UIKit                          0x198b2c534 UIApplicationMain + 208
22 MYAPPPPPP                      0x100059138 main (UserDefaultsWrapper.swift:21)
23 libdispatch.dylib              0x191acd5b8 (Missing)

对我而言,好像是这行在appdelegate启动时崩溃:

specialized static FFBaseApiService.accessTokenGetString.getter (FFBaseApiService.swift)

这是代码:

class var accessTokenGetString : String {
    return "?accessToken=\(currentUserAccessToken)"
}

class var currentUserAccessToken : String {
    return FFUserManager.sharedInstance.getUserAccessToken()
}

另外,我使用的是realm,getUserAccessToken看起来像这样:

func getUserAccessToken() -> String {
        if let user = user, let accessToken = user.accessToken {
            return accessToken
        }
        else {
            print("Returning empty access token")
            return ""
        }

    }

以这样的方式提取用户属性:

private var user : FFUser? {
    return realm.objects(FFUser.self).first
}

我没有任何想法,无论这里有什么不妥。任何人?

0 个答案:

没有答案