注册推送通知时,iPhone应用程序崩溃

时间:2019-02-19 10:36:55

标签: ios push-notification swift4 registration

我正在使用推板敲定IOS应用程序(xcode9,swift 4)。应用安装后,会要求用户注册“ Notifications”,然后运行NetworkService:PushNotificationsNetworkable,更具体地说:

self.networkRequest(request, session: self.session) { (response) in 
    switch response { 
        case .Success(let data): 
           guard let device = try? JSONDecoder().decode(Device.self, from: data) else {   
               return 
           } 
//crashes here 
       completion(device.id, true) 


        case .Failure(let data): 
             guard (try? JSONDecoder().decode(Reason.self, from: data)) != nil else { return } 
            completion(nil, false) 
    } 
}

应用程序每次都崩溃(标记为“在此之上崩溃”)。然后,我收到以下消息:

1 0x0000000106a0a260在Pods / PushNotifications / Sources / NetworkService.swift:25中的封闭#1中

你能给我什么建议吗?

0 个答案:

没有答案