iOS-仅在应用统计信息被杀死时才发生在单击推送通知时应用崩溃

时间:2019-03-16 07:13:50

标签: ios

我构建了IOS应用程序,并在其上使用了推送通知。当我的应用程序状态为后台或前景时,推送通知单击工作正常,但是当状态被终止时,我单击通知应用程序崩溃,并且由于应用程序已处于终止状态,我无法看到日志。是什么原因?

我在AppDelegate中使用以下代码:

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    notificaionsCount = "\(UIApplication.shared.applicationIconBadgeNumber)"

    FirebaseApp.configure()
    Fabric.with([Crashlytics.self])
    brainClient = BTAPIClient.init(authorization: ProjectSingletenClass.shared.clientTokenOrTokenizationKey)
    BTUIKAppearance.darkTheme()
    UNUserNotificationCenter.current().delegate = self
    IQKeyboardManager.sharedManager().enable = true
    STPPaymentConfiguration.shared().publishableKey = ProjectSingletenClass.shared.publishableKeyForStripe
    sinchManagedPush = Sinch.managedPush(with: SINAPSEnvironment.development)
    sinchManagedPush?.delegate = self
    sinchManagedPush?.setDesiredPushTypeAutomatically()
    sinchManagedPush?.registerUserNotificationSettings()
    let dispatch_Queue : DispatchQueue? = DispatchQueue.init(label: "Latter")
    pushRegistry = PKPushRegistry.init(queue: dispatch_Queue)
    pushRegistry.delegate = self
    //let pushTypeSet : Set<PKPushType>?
    pushRegistry.desiredPushTypes = NSSet.init(object: PKPushType.voIP) as? Set<PKPushType>
    NotificationCenter.default.addObserver(self,
                                           selector: #selector(tokenRefreshNotification(_:)),
                                           name: NSNotification.Name.InstanceIDTokenRefresh,
                                           object: nil)
    registerForPushNotifications(application)
    SVProgressHUD.setBackgroundColor(UIColor.cherryRed)

    return true
}

0 个答案:

没有答案