-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS notification crashes when its opened #94
Comments
same issue here with
starting with iOS 14.
|
the code fails here after user clicks onto the push notification in iOS notification center:
log:
it seems like this handler is called multiple times, which leads into this error on the second time. @erisu could you have a look into this? |
@cyptus Don't set the "content-available" field to fcm payload unless you absolutely need background notifications. When set the "content-available" field: Call PushNotification.finish() |
Same issue here, causing serious disturbance on our app since background notifications are mandatory. Sad to see such an important plugin abandoned (instead of being part of the core of Cordova). |
This is DEFINITELY not a solution, but the last time I coded obj-c was in school, 11 years ago. I'm definitely not willing to understand in which scenarios the completionHandler is called more than once. I hacked this solution with a rough idea and ChatGPT's guidance on how to do almost anything in this weird language. WORKAROUND DISCLAIMER (if it isn't clear enough from the code comment): if you repeat the same notification body, it will probably have the same notId (it had in my test cases), and thus it will fail to call the completion handler, causing a warning. However, I guess that's better than a full application crash lol Not sure if that could cause a memory leak or stuff like that... also, not sure if this arbitrarily long NSMutableDictionary could grow terribly large and cause issues; I hope your app doesn't get too many notifications in its lifetime.
I hacked a dirty workaround for the issue: it counts how many times the completion handler was called, avoiding calling it multiple times. I'm not opening a PR because this is not a solution, and it potentially have two drawbacks:
How to use it: I have no clue how to do it cleanly nowadays. My |
Hi, how are you?
I'm experiencing a weird issue in iOS build. When the user receives a notification an taps on it, the app is opened and crashes.
I'm not able to reproduce the issue in the simulator, notifications are working as expected.
Expected Behaviour
The app is opened
Actual Behaviour
The app crashes.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iPhone12,8
cordova info
PrintoutIonic:
Ionic CLI : 6.12.2 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.4
@angular-devkit/build-angular : 0.901.15
@angular-devkit/schematics : 9.1.15
@angular/cli : 9.1.15
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : 5.0.4, android 9.1.0, browser, ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 10 other plugins)
Utility:
cordova-res (update available: 0.15.3) : 0.15.1
native-run : 1.3.0
System:
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v12.13.0 (/usr/local/bin/node)
npm : 6.12.0
OS : macOS Catalina
Xcode : Xcode 12.4 Build version 12D4e
Logs taken while reproducing problem
I see this crashlog in TestFlight, attached.
crashlog.txt
Let me know if you have any doubts
The text was updated successfully, but these errors were encountered: