ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
488 stars 567 forks source link

Push notifications - never got token on iOS #1194

Closed nowitz closed 1 year ago

nowitz commented 1 year ago

Bug Report

Plugin(s)

@capacitor/push-notifications v4.1.0

Capacitor Version

[capacitor] √ Copying web assets from www to android\app\src\main\assets\public in 1.29s
[capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 938.00μs
[capacitor] [info] Found 2 Cordova plugins for android:
[capacitor]        cordova-plugin-advanced-http@3.3.1
[capacitor]        cordova-plugin-file@7.0.0
[capacitor] √ copy android in 1.41s
[capacitor] √ Updating Android plugins in 9.12ms
[capacitor] [info] Found 11 Capacitor plugins for android:
[capacitor]        @capacitor-community/admob@4.0.0
[capacitor]        @capacitor-firebase/analytics@1.0.0
[capacitor]        @capacitor/app@4.0.1
[capacitor]        @capacitor/device@4.0.1
[capacitor]        @capacitor/haptics@4.0.1
[capacitor]        @capacitor/keyboard@4.0.1
[capacitor]        @capacitor/network@4.0.1
[capacitor]        @capacitor/preferences@4.0.1
[capacitor]        @capacitor/push-notifications@4.1.0
[capacitor]        @capacitor/splash-screen@4.0.1
[capacitor]        @capacitor/status-bar@4.0.1
  @capacitor/ios: 4.3.0

Installed Dependencies:

  @capacitor/core: 4.2.0
  @capacitor/cli: 4.2.0
  @capacitor/android: 4.2.0
  @capacitor/ios: 4.2.0

Platform(s)

Emulator iPhone 14Pro - iOS 16

Current Behavior

On Android is everything OK.

On iOS never get token from listener (PushNotifications.addListener('registration', token => ....) I see in the log but no error message:

⚡️  To Native ->  PushNotifications checkPermissions 98935768
⚡️  To Native ->  PushNotifications register 98935777
⚡️  To Native ->  PushNotifications addListener 98935779
⚡️  To Native ->  PushNotifications addListener 98935780
⚡️  To Native ->  PushNotifications addListener 98935781
⚡️  To Native ->  PushNotifications addListener 98935782

Expected Behavior

Registration listener return token.

Code Reproduction

I followed the instructions: https://capacitorjs.com/docs/guides/push-notifications-firebase and have all certificate image

Snímek obrazovky 2022-09-22 v 21 49 22 Snímek obrazovky 2022-09-22 v 21 50 34 Snímek obrazovky 2022-09-22 v 21 54 59

Other Technical Details

jcesarmobile commented 1 year ago

For being able to test push notifications on an iOS 16 simulator you need to update to macOS 13 (which is not final yet, but you can install the betas). The computer also need an Apple Silicon or T2 processor for push notifications to work.

I've tested and it's working fine on my iPadOS 16 iPad, so closing.

Also, as you want to use Firebase, Firebase might need an update in the future, it's not clear if it supports simulators at the moment, see linked issue https://github.com/firebase/firebase-ios-sdk/issues/9968

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.