alexeyxo / swift-apns

Swift Framework for sending Apple Push Notification over HTTP/2 API
Apache License 2.0
154 stars 20 forks source link

Fatal error in sendPush #4

Closed didier-v closed 8 years ago

didier-v commented 8 years ago

The error happens in the completion handler of the task: in APNSNetwork.swift -> sendPush

 let task = self.session?.dataTaskWithRequest(request, completionHandler: { (data, response, err) -> Void in
let (statusCode, status) = APNServiceStatus.checkStatusCode((response as! NSHTTPURLResponse)) 

I got an error (err = Error Domain=NSURLErrorDomain Code=-1001 "The request timed out.") and response is nil Force unwrap of response causes a fatal error.

alexeyxo commented 8 years ago

Bug is fixed in swift3.0 branch.