在iOS 10中处理远程通知时发生崩溃

时间:2018-07-28 03:19:03

标签: ios swift push-notification apple-push-notifications

崩溃报告在Fabric生成的崩溃报告中显示forceBridgingFromObjectiveC(:)和无条件地BridingFromObjectC(:)。

 @available(iOS 10.0, *)
func processRemoteNotificationForIOS10(response : UNNotificationResponse)
{
    AppDelegate.getAppDelegate().log.debug("")
    if self.launchOptions != nil && self.launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? NSDictionary == nil
    {
        AppDelegate.getAppDelegate().log.debug("Tapped on remote notification when the app is closed & info is nil")
        return
    }
    if (QRSessionManager.getInstance()?.getCurrentSession().userSessionStatus != .User) {
        return
    }
    guard let notificationResponse :[AnyHashable : Any] = response.notification.request.content.userInfo else{
        return
    }
    let newUserNotification: UserNotification? = getUserNotificationFromRemoteNotification(userInfo: notificationResponse)
    if (newUserNotification != nil) {
        if response.actionIdentifier == "com.apple.UNNotificationDefaultActionIdentifier"
        {
            handleUserNotification(newUserNotification: newUserNotification!)
        }
        else
        {
            self.handleUserNotificationAction(clientNotification: newUserNotification!, response : response)
        }
    }else{
        QuickRideRemoteBackgroundNotificationHandler().handleRemoteNotifications(userInfo: response.notification.request.content.userInfo)
    }
}

崩溃发生在这部分代码中。在代码中出现错误的任何建议。

0 个答案:

没有答案