In push notification, isRegisteredForRemoteNotifications this method will return NO in simulator, But in the device it will return YES. Why its react like this? Every time I need to change in the code when I run in device.
Asked
Active
Viewed 639 times
3
-
push notification not working in simulator , because its not returns device token – Ilesh P Dec 07 '15 at 12:31
-
Possible duplicate of [Push Notifications in Mavericks iOS Simulator](http://stackoverflow.com/questions/21741259/push-notifications-in-mavericks-ios-simulator) – Jakub Dec 09 '15 at 17:09
3 Answers
3
Simlulators doesn't have functionality to generate the device token.So if there is not device token then notification related methods and functionality will not work.
Anil solanki
- 962
- 4
- 20
1
When you register for Remote Notification, it gives you device token which you use to send to server for getting push notification. But in case of simulator you will not get any device token because of why you will not getting notification from server.
Try the same by debugging on iOS device than you will be able to get notifications.
Vijay Sanghavi
- 340
- 1
- 5
- 23
-
Yes I understood. But my provision profiles are not enabled push notifications. So its not getting device token and all. Simulator asking alert for enable push notification so its just registered in simulator right ? – Mani Apple Dec 07 '15 at 13:00
-
Its not like that, when you register for remote notification iOS ask for permissions on every device for first time. If you want to test this on device but not on simulator than make a valid **Provisioning Profile** and **APNS** certificate. – Vijay Sanghavi Dec 07 '15 at 13:08