capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

docs(@capacitor/push-notifications): Add common issue about iOS simulator support and device tokens

Open matthewbal opened this issue 1 year ago • 2 comments

Feature Request

Plugin

  • push-notifications

Description

Add a short section into the readme to let developers know that the iOS simulator does not support push notification registration. I spent too long trying to figure out why the registration and registrationError listener events were not firing for me, and it turns out that for me, on Xcode 14.2 with an ios 16.1 simulator, the failure is totally silent and simply doesn't fire the event didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError in the appdelegate (confirmed with print statement debugging).

I confirmed that my project works fine on a physical device, so it is indeed only the iOS simulator which doesn't support registering a device token.

Platform(s)

Docs only

Preferred Solution

Adding the section into the readme.

Alternatives

There might be a way to detect if the user is in a simulator and throw an error to the registrationError event.

Additional Context

https://stackoverflow.com/questions/1080556/how-can-i-test-apple-push-notification-service-without-an-iphone/60085404#60085404

matthewbal avatar Feb 07 '24 09:02 matthewbal

aha, I just saw this comment:

With macOS 13 and Xcode 14, when on Mac computers with Apple silicon or T2 processors, it’s now possible to receive real push notifications as didRegisterForRemoteNotificationsWithDeviceToken will return a real token.

I will edit the wording of my PR to mention this.

matthewbal avatar Feb 07 '24 10:02 matthewbal

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar Feb 23 '24 16:02 ionitron-bot[bot]