I have copy pasted the code from another application of mine. On the other one everything is working fine. Only difference is, I have updated to the latest Xcode release.
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
print("token: \(deviceToken)")
// prepare the token to be saved from <xxxxxxxx xxxxxxxx...> to xxxxxxxxxxxxxxxxx...
var token = NSString(format: "%@", deviceToken)
token = token.stringByReplacingOccurrencesOfString(
"<",
withString: "")
token = token.stringByReplacingOccurrencesOfString(
">",
withString: "")
token = token.stringByReplacingOccurrencesOfString(" ", withString: "")
print(token)
if Reachability.isConnectedToNetwork() == true {
backendless.messaging.registerDeviceToken(token as String)
}
}