ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
529 stars 597 forks source link

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

Open matthewbal opened 9 months ago

matthewbal commented 9 months ago

Feature Request

Plugin

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 commented 9 months ago

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.

ionitron-bot[bot] commented 8 months ago

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.