简体   繁体   English

fcm onMessage 在模拟器上工作,但在物理设备上不起作用

[英]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 .所以我使用了flutterfirebase-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 ).其他回调确实有效( onLaunchonResume )。 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.

相关问题 为什么这段代码可以在 Xcode 模拟器上运行,但不能在设备上运行? - Why does this code works on Xcode simulator, but does not work on device? 内容拦截器在模拟器中工作,但在iPhone设备中不起作用 - content blocker works in simulator but does not work in iPhone device Firebase 在 ios 模拟器上运行良好,但在真实设备上不起作用 - Firebase works fine on ios simulator but it does't work on real device Xamarin.ios 不适用于真正的 iOS 设备,但它适用于模拟器 - Xamarin.ios does NOT work on real iOS device but it works on Simulator 模拟器 FirebaseAuth 有效! 但不是物理设备。 错误“令牌不匹配” - Simulator FirebaseAuth works! But not a physical device. Error 'Token Mismatch' Xcode 布局变化在模拟器上工作但在物理设备上消失 - Xcode Layout Variations Work on Simulator but Disappears on Physical Device aqgridview可在模拟器中运行,但无法在设备上运行 - aqgridview works in simulator but fail to work on the device UISearchBar在模拟器上可用,但在设备上不可用 - UISearchBar works on simulator but doesn't work on device SQLite3选择适用于模拟器,但不适用于设备 - SQLite3 selection works on simulator but it does not on device 应用程序为模拟器而不是物理设备编译 - App compiles for a simulator but not a physical device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM