2016-04-05 3 views
2

Ich habe ein iOS-Projekt und im Debug-Modus, überhaupt keinen Absturz. Bei der Freigabe der App zu TestFlight, starte ich die App von Testflight-Schnittstelle (mit dem Öffnen-Button), bekomme ich einen Absturz.App stürzt beim Starten von Testflight ab Öffnen Sie die Schaltfläche

Wenn ich die App vom iPhone Home-Bildschirm starten, kein Absturz.

Thread : Crashed: com.apple.main-thread 
0 AppName       0x100316b8c specialized AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool (AppDelegate.swift) 
1 AppName       0x100314284 @objc AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool (AppDelegate.swift) 
2 UIKit       0x1863428a8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400 
3 UIKit       0x186572094 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904 
4 UIKit       0x186576500 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684 
5 UIKit       0x186573674 -[UIApplication workspaceDidEndTransaction:] + 168 
6 FrontBoardServices    0x182b237ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 
7 FrontBoardServices    0x182b23618 -[FBSSerialQueue _performNext] + 168 
8 FrontBoardServices    0x182b239c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 
9 CoreFoundation     0x181139124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 
10 CoreFoundation     0x181138bb8 __CFRunLoopDoSources0 + 540 
11 CoreFoundation     0x1811368b8 __CFRunLoopRun + 724 
12 CoreFoundation     0x181060d10 CFRunLoopRunSpecific + 384 
13 UIKit       0x18633b834 -[UIApplication _run] + 460 
14 UIKit       0x186335f70 UIApplicationMain + 204 
15 AppName       0x100316388 main (AppDelegate.swift:18) 
16 libdispatch.dylib    0x180bfe8b8 (Missing) 

EDIT

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
    // Override point for customization after application launch. 
    Fabric.with([Crashlytics.self]) 
    log.xcodeColorsEnabled = true 
    let dateFormatter = NSDateFormatter() 
    dateFormatter.dateFormat = "HH:mm:ss.SSS" 
    dateFormatter.locale = NSLocale.currentLocale() 
    log.dateFormatter = dateFormatter 
    #if DEBUG 
     log.setup(.Debug, showLogIdentifier: false, showFunctionName: true, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, showDate: true, writeToFile: nil, fileLogLevel: nil) 
    #else 
     log.setup(.Severe, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil) 
     if let consoleLog = log.logDestination(XCGLogger.Constants.baseConsoleLogDestinationIdentifier) as? XCGConsoleLogDestination { 
     consoleLog.logQueue = XCGLogger.logQueue 
     } 
    #endif 

    application.applicationIconBadgeNumber = 0 

    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(AppDelegate.mergeChanges(_:)), name: NSManagedObjectContextDidSaveNotification, object: nil) 

    //MARK: - Notifications registration 
    remoteToken() 

    if let launchOpts = launchOptions { 
     let remoteNotification = launchOpts[UIApplicationLaunchOptionsRemoteNotificationKey] as! NSDictionary 
     if let notifFrom = remoteNotification["from"] as? Int, notifType = remoteNotification["type"] as? Int { 
     let userid = notifFrom 
     let type = notifType 
     if type != MessageType.NotifyMsgType.rawValue { 
      loadingChatUserId = userid 
     }else{ 
      loadingChatUserId = nil 
     } 
     } 
    }else{ 
     loadingChatUserId = nil 
    } 

    return true 
    } 

func remoteToken() { 
    if UIApplication.sharedApplication().isRegisteredForRemoteNotifications() { 
     //iOS 8 notifications 
     UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [UIUserNotificationType.Sound, .Alert, .Badge], categories: nil)) 
     UIApplication.sharedApplication().registerForRemoteNotifications() 
    } 
    } 
+0

Überprüfung dieser libdispatch.dylib Datei in Projekt –

+0

Sie könnten einige Code in der AppDelegate haben, die Sie ... wollen nicht vielleicht die Datei schreiben? – aramusss

+0

Gute Idee, ich habe den Delegierten didLaunchingWithOption – Mikael

Antwort

2
if let launchOpts = launchOptions { 
    let remoteNotification = launchOpts[UIApplicationLaunchOptionsRemoteNotificationKey] as! NSDictionary 
    if let notifFrom = remoteNotification["from"] as? Int, notifType = remoteNotification["type"] as? Int { 
    let userid = notifFrom 
    let type = notifType 
    if type != MessageType.NotifyMsgType.rawValue { 
     loadingChatUserId = userid 
    }else{ 
     loadingChatUserId = nil 
    } 
    } 
}else{ 
    loadingChatUserId = nil 
} 

Hier ist Ihr Problem ... Sie sind Kraft Abwickeln Startoption als UIApplicationLaunchOptionsRemoteNotificationKey. Verwenden Sie stattdessen eine optionale Bindung.

if let launchOpts = launchOptions { 
    if let remoteNotification = launchOpts[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary{ 
     .... 
    } 
+0

Wenn ich Ihnen 200 Punkte geben könnte, würde ich! Danke vielmals. Das hat meinen Tag gerettet. – lnjuanj

Verwandte Themen