[英]fcm onMessage works on simulator but does not work in physical device
I am a web developer trying to build a simple hybrid webview app with push notification.我是一名 web 开发人员,试图构建一个带有推送通知的简单混合 webview 应用程序。 So I used
flutter
and firebase-cloud-messaging
.所以我使用了
flutter
和firebase-cloud-messaging
。 The android
side works fine in both emulator and on a physical android phone. android
端在模拟器和物理 android 手机上都可以正常工作。
But for ios I have a problem.但是对于ios我有一个问题。 The
onMessage
callback works in the simulator and generates a AlertDialog
. onMessage
回调在模拟器中工作并生成AlertDialog
。 But when I test it on a physical iphone, it doesnt work.但是当我在物理 iphone 上测试它时,它不起作用。 Nothing pops up.
什么都没有弹出。 The other callbacks do work(
onLaunch
, onResume
).其他回调确实有效(
onLaunch
, onResume
)。 Another weird part, is that as soon as the test app is installed on the physical device, the terminal loses connection to the device.另一个奇怪的部分是,一旦测试应用程序安装在物理设备上,终端就会失去与设备的连接。 So I cannot even see the error logs.
所以我什至看不到错误日志。
For me, It depends on version of对我来说,这取决于版本
implementation 'com.google.firebase:firebase-messaging:20.1.0'
on build.gradle在 build.gradle 上
implementation 'com.google.firebase:firebase-messaging:20.1.0'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.