我正在使用推板敲定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)
}
}
应用程序每次都崩溃(标记为“在此之上崩溃”)。然后,我收到以下消息:
你能给我什么建议吗?