I have to developp an app that uses Push Notification in a particular way, and I had a pretty tricky question : can the device token be stored locally in the app sandbox?
Here’s the why : this app should implement a notification system that allows the user to subscribe for some particular events only, from the iphone.
So to do so, I need to send to my database the Device Token of the iPhone at any time when the app is running, and from what I get, the device token is only avaliable when the
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
is called right?
Or is there any way to retrieve this information later?
Thanks.
You should store it somewhere on the phone. NSUserDefaults is a decent place to do it since it’s not a big piece of data and you can retrieve it easily afterwards. I would also recommend saving it on your server, and only updating it if the token changes.