urbanairship / airship-flutter

Flutter integration
Other
17 stars 17 forks source link

Not able to get a push notification on my iOS device from a TEST Airship project #191

Closed AnastasiiaSob closed 8 months ago

AnastasiiaSob commented 11 months ago

Preliminary Info

What Airship dependencies are you using?

airship_flutter: ^7.1.2

What are the versions of any relevant development tools you are using?

Flutter 3.13.9 Dart 3.1.5

iOS Device version 17.1 XCode version 15.0.1

Report

What unexpected behavior are you seeing?

Getting the message in my terminal and no push notification is shown: [VERBOSE-2:shell.cc(1004)] The 'com.airship.flutter/event/push_received' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.

What is the expected behavior?

Push notification is shown on a mobile when app running locally. The push notification is sent from an Airship TEST project. On Android it works fine.

What are the steps to reproduce the unexpected behavior?

Just send a test push notification to your locally running app from a TEST Airship project.

crow commented 11 months ago

@AnastasiiaSob We've identified a likely cause and are currently testing a patch. Will update you when we've confirmed the fix.

AnastasiiaSob commented 8 months ago

@crow could you please provide any updates on the patch?

crow commented 8 months ago

@AnastasiiaSob Apologies for the late reply. We've released 7.3.1 since this last exchange - so it makes sense to update to this version before proceeding with troubleshooting.

To troubleshoot your issue I set up a test app in go.airship.com and replaced the latest example project credentials with the test app credentials from go.airship.com. After doing so, I was able to receive pushes without any issue.

Try this out with your own credentials from go.airship.com and let me know if you're able to receive pushes. If you are, it means there's likely a configuration issue in your project thats affecting iOS but not Android.

One other thing to try is to background your app when you send your test push. Push handling on iOS when the app is foregrounded is provided by the app itself instead of iOS, so sometimes it can seem like the push isn't being received at all when it's actually just not being displayed. This seems somewhat less likely in your case, but doesn't hurt to be aware of.

AnastasiiaSob commented 8 months ago

Thank you for your reply @crow ! It is indeed the last case you mentioned: I am able to receive a push notification when the app is in background, but when the app is in foreground I see neither the initial error nor the push notification. So the app can't display the push notification, but I can see in terminal that Airship.push.onPushReceived.listen has received the notification. Do you know if this issue could be caused by my incorrect usage of the Airship dependency in the app or by any other dependency or app setup?

AnastasiiaSob commented 8 months ago

I solved the issue by adding Foreground Presentation Options for iOS.