I'm trying to get a few friends of mine to test my app on TestFlight. This all is going fine except for the Push notifications. I do not seem to be able to extract their Push tokens. I've double checked and they've granted the app permission to take the Push token.
In my opinion this all looks fine:
Apple does however send the following e-mail after I upload the app to TestFlight:
Missing Push Notification Entitlement - Your app includes an API for Apple's Push Notification service, but the aps-environment entitlement is missing from the app's signature. To resolve this, make sure your App ID is enabled for push notification in the Provisioning Portal. Then, sign your app with a distribution provisioning profile that includes the aps-environment entitlement. This will create the correct signature, and you can resubmit your app. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.
I am able to extract my own device's Push token when downloading a fresh copy from TestFlight.
I've no idea what's going on and would really like to fix this. Can anyone help me out?
In case it helps. This is my code:
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
var tokenString = ""
for i in 0..<deviceToken.length {
tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
}
Constant.pushToken = tokenString
if (KeychainWrapper.hasValueForKey("user_id")){
let user = User()
user.id = Int(KeychainWrapper.stringForKey("user_id")!)!
ApiManager.sharedInstance.putPushToken(user){ (result, error) -> Void in
if error != nil {
//error
} else {
//success
}
}
}
}