我的应用程序工作正常,如果我从主屏幕打开但是当我从TestFlight应用程序打开按钮打开它时,它会通过给出我从Crashlytics获得的错误而崩溃。
#0. Crashed: com.apple.main-thread
0 ABC 0x4f1778 specialized AppDelegate.handleRemoteNotificationFromKilledState([NSObject : AnyObject]) -> () (AppDelegate.swift:183)
1 Abc 0x10f3b8 specialised static _VariantDictionaryStorage.maybeGetFromCocoaStorage(_CocoaDictionaryStorage, forKey : A) -> B? (ViewController.swift)
2 ABC 0x4f212c specialized AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool (AppDelegate.swift)
3 abc 0x4ed0dc @objc AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool (AppDelegate.swift)
4 UIKit 0x24f82a6f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 394
5 UIKit 0x251ac287 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3086
6 UIKit 0x251b0241 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1588
7 UIKit 0x251c4811 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3286 + 36
8 UIKit 0x251ad767 -[UIApplication workspaceDidEndTransaction:] + 134
9 FrontBoardServices 0x21ffbbf7 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 18
10 FrontBoardServices 0x21ffbaa7 -[FBSSerialQueue _performNext] + 226
11 FrontBoardServices 0x21ffbda5 -[FBSSerialQueue _performNextFromRunLoopSource] + 44
12 CoreFoundation 0x208ef9e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
13 CoreFoundation 0x208ef5d7 __CFRunLoopDoSources0 + 454
14 CoreFoundation 0x208ed93f __CFRunLoopRun + 806
15 CoreFoundation 0x2083c1c9 CFRunLoopRunSpecific + 516
16 CoreFoundation 0x2083bfbd CFRunLoopRunInMode + 108
17 UIKit 0x24f7bf37 -[UIApplication _run] + 526
18 UIKit 0x24f76435 UIApplicationMain + 144
19 abc 0x4ef4ec main (AppDelegate.swift:16)
20 libdispatch.dylib 0x204e8873 (Missing)
关于为什么会发生这种情况的任何想法。
先谢谢!!
更新: - AppDelegate.handleRemoteNotificationFromKilledState的代码([NSObject:AnyObject])
func handleRemoteNotificationFromKilledState(userInfo:[NSObject : AnyObject]) {
var pushDict = userInfo[UIApplicationLaunchOptionsRemoteNotificationKey] as! Dictionary<NSObject,AnyObject>
let dict = pushDict["abc"] as? NSDictionary
if (dict?.valueForKey("alert") as? NSString) != nil {
let alert = dict?.valueForKey("alert") as! NSString
if let type=pushDict["NT"] as? NSString {
if type == "TO_ViewController_One" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_One"
} else if type == "TO_ViewController_Two" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Two"
} else if type == "TO_ViewController_Three" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Three"
} else if type == "TO_ViewController_Five" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Five"
} else if type == "TO_ViewController_Four" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Four"
} else if type == "TO_ViewController_Six" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Six"
} else if type == "TO_ViewController_Seven" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Seven"
} else if type == "TO_ViewController_Eight" {
let qcid = pushDict["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = "TO_ViewController_Eight"
} else {
let qcid = userInfo["abcID"] as? String
self.notificationdictForkilled["qcid"] = qcid
self.notificationdictForkilled["ToViewController"] = type as String
}
self.viewstate = "Killed"
}
}
}