0

I had my app for iOS 9 implementing application(_:didRegisterForRemoteNotificationsWithDeviceToken:) that gets invoked whether or not user accepts to receive Push Notifications, hence I get and store on the remote server the device token in both cases.

Now with iOS 10 this delegate method never gets called if user does not accept to receive Push Notifications... Is there any other way to get the device token in such a case?

Ahmed Khedr
  • 1,053
  • 1
  • 11
  • 24

2 Answers2

0

You can't. If user doesn't accept notifications, you can't get any token for this.

mhergon
  • 1,688
  • 1
  • 18
  • 39
  • Can I use this: `UIDevice.current.identifierForVendor!.uuidString` to get a unique identifier for the device? I need to identify each device as this is the way the remote db is structured! – Ahmed Khedr Feb 24 '17 at 16:48
  • 1
    You can, but remember that this id changes in many certain situations. See documentation – mhergon Feb 24 '17 at 16:50
0

This is the fact when user not accept to receive notification then application will not generate device token or sometime by mistake click on don't allow option, so whenever you want to need app required Push notification need to show any popup(Alert view) message there for why you need push notification access inside app then second time give some tutorial/advice/guidance for how user enable manually push notification service from iOS device Setting option.

Anand Nimje
  • 6,163
  • 4
  • 24
  • 43