Good day!
Recently, we are doing the feasibility study for transferring our App from team A to team B. Our App uses Apple Push Notifications service (APNs) and we know we need to recreate certificates after the App transferring. We have a question that can we use the old device tokens which are registered before the transferring to send the notification to users?
For example, Before the transfer: User A installs App and upload tokenA_old to our service server. Our service server stored it into our database.
After the transfer: User A doesn’t launch App and we only have the tokenA_old which is stored in our server. After we recreate push notification certificate, can we send notification with tokenA_old to user A? Or his device token will be renewed after the App is transferred? Does he need to launch App and get the new registered device token from APNs and upload it to our server again?
override func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
let deviceTokenString = deviceToken.map { String(format: "%02x", $0) }.joined()
uploadDeviceToken(deviceTokenString)
}
We want to check above question for following tokens:
- deviceToken (Push notification)
API: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622958-application
- pushToStartToken (Live activity)
API: https://developer.apple.com/documentation/activitykit/activity/pushtostarttoken
Does deviceToken will be renewed after the App is transferred? Does pushToStartToken will be renewed after the App is transferred?
Thank you.
Both APNs and Live Activity push tokens (also true for PushKit tokens) are based on the app's Bundle ID, and the Team which built it, or the team who happens to own it once it had been built does not have any effect on the token or the ability to receive said pushes.
The team ownership only matters when sending the pushes. That is, the team sending a push to an app needs to prove it's ownership of the app by authenticating with the correct credentials (APNs certificates or keys).
So, no, the app tokens will not change because the app was transferred. Of course, there are cases where app tokens can change unrelated to a transfer, and you should be aware of that, and should already have included that in your app's logic (like checking for tokens at every launch and updating your token database if there has been changes).
To quickly summarize: As long as the Bundle ID does not change, the new team will be able to send notifications to the old version of the app which has been built by the old team. Once the app's ownership has passed to the new team, the new credentials can be used for that app/apns-topic, regardless of who signed the app that is running on the user's device. It might be easier to think of this as not sending a notification to an app, but to a topic, and who has the right to send any notifications to that topic. In most cases the topic is the app's Bundle ID.
The app and the associated token should continue to receive notifications, and you can use the existing infrastructure and credentials during transfer. But once the transfer is complete the existing Certificates or APNs Auth Keys from the old Team will stop working.
Once the transfer is complete, the apns-topic (which is, or based on the app Bundle ID) to send the pushes to will no longer belong to the old team, and their credentials can no longer be used. Once the topic is moved to the new team's account, only the new team can authenticate.
When the app is removed from the old team, their push requests will start to fail. At that point, you should be able to start using the Certificates or Keys generated by the new team. Even though there could be a gap between the two, we expect the time span to be trivial.
NOTE after the transfer, any and all connections from your push servers to APNs will need to be reset and new connections with the new credentials established.
Argun Tekant / DTS Engineer / Core Technologies