ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.44k stars 977 forks source link

iOS Push notification - no system alert #2998

Closed mpawlak96 closed 4 years ago

mpawlak96 commented 4 years ago

Bug Report

After recompile my app. Application isnt asking on iOS to push notification access (system alert). Last days i updated my xcode (11.5).

From App im getting token (see below) but modal for push notification wont show. Probably this token is for local push notifications ? By Apple Push Service i cant push hany notification. im getting error number: 475

Capacitor Version

npx cap doctor output:

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 2.1.1

@capacitor/core: 2.1.1

@capacitor/android: 2.1.1

@capacitor/ios: 2.1.1

Installed Dependencies:

@capacitor/cli 1.5.1

@capacitor/ios 2.0.0-beta.1

@capacitor/core 1.5.1

@capacitor/android 1.5.1

[success] Android looking great! 👌 Found 6 Capacitor plugins for ios: capacitor-firebase-analytics (0.3.2) cordova-open-native-settings (1.5.2) cordova-plugin-facebook4 (6.4.0) cordova-plugin-purchase (10.0.1) cordova-plugin-qrscanner-ean (1.0.1) cordova-plugin-smartlook (1.0.0) [success] iOS looking great! 👌

Affected Platform(s)

Console debug:

⚡️ To Native -> PushNotifications register 118480378 ⚡️ To Native -> PushNotifications addListener 118480379 ⚡️ To Native -> PushNotifications addListener 118480380 ⚡️ To Native -> PushNotifications addListener 118480381 ⚡️ To Native -> PushNotifications removeAllDeliveredNotifications 118480382 ⚡️ To Native -> App addListener 118480383 ⚡️ TO JS {"value":"XXXXXXXXXXX"} ⚡️ [log] - Push registration success, token: XXXXXXXXXXXXX

Expected Behavior

Sample Code or Sample Application Repo

Main file: useEffect(() => { pushNotificationsInit(dispatch, history) }, [])

pushNotificationsInit:

`export default (dispatch, history) => { const { PushNotifications, App } = Plugins PushNotifications.register()

PushNotifications.addListener('registration', async (token) => { console.log(Push registration success, token: ${token.value}) [..]`

Other Technical Details

npm --version output: 6.14.4

node --version output: v12.16.2

pod --version output (iOS issues only): 1.8.3

Other Information

https://stackoverflow.com/questions/62047012/push-notification-alert-doesnt-show

jcesarmobile commented 4 years ago

Can you provide a sample app?

mpawlak96 commented 4 years ago

Hello! Yes. give me a few mins to prepare a sample app

mpawlak96 commented 4 years ago

@jcesarmobile I added you to my private project, please check DM

mpawlak96 commented 4 years ago

Generally i tried to create fresh app based on newest version of capacitor and i only added pushinit (the same as in project which i shared you) and problem is the same - im not getting system alert modal (im getting toket but this token doesnt work).

Please help :<

jcesarmobile commented 4 years ago

you have not committed the src folder

mpawlak96 commented 4 years ago

Im so sorry ;). Now i pushed src/ to master branch

jcesarmobile commented 4 years ago

since v2 of capacitor, register doesn't request the permissions, there is a requestPermission method for that

it was mentioned in the breaking changes https://github.com/ionic-team/capacitor/releases/tag/2.0.0

but I guess it should be documented better

jcesarmobile commented 4 years ago

it's requestPermission(), not requestPermissions()

you've deleted the comment where you say you can't find requestPermission(), but that's because you have not updated @capacitor/core, as I said, it was included in v2, you have to update all capacitor packages

mpawlak96 commented 4 years ago

Yes now i see requestPremission and it works fine!

Last question. how can i get i get information in event 'registration' that it is a remote token ?

jcesarmobile commented 4 years ago

there are only remote tokens, so whatever you get in registration event is a remote token

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 Capacitor, please create a new issue and ensure the template is fully filled out.