Reputation: 1288
Since iOS 9 application changes apns token after reinstallation of an application. But iOS 8 and 7 doesn't do it.
How can I distinguish next situation using iOS 8 and iOS 7?
After these actions, this unregisterd user will get notifications about some actions in his account without needs to log in. If it were a bank/finance app, it would influence the security of registered user.
How to prevent this?
Upvotes: 1
Views: 128
Reputation: 11039
You can call
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
in
-application:didFinishLaunchingWithOptions:
method. Then, when user logs in, register for remote notifications.
But anyway, if app is uninstalled and installed again, it will not receive push notifications until -registerForRemoteNotifications
get called, and you must call this method ONLY after user authentication. Even if token is same as previous one, it will associated with this new user, and your server should handle that.
Upvotes: 2