简体   繁体   English

如何调试在 iOS > 14 上打开的 Flutter 通知

[英]How to debug Flutter notifications opening on iOS > 14

Since iOS 14.0 Flutter apps can't be relaunched in debug mode .由于 iOS 14.0 Flutter 应用程序无法在调试模式下重新启动

So how do you get some logs while implementing firebase_messaging methods?那么在实现firebase_messaging方法时如何获取一些日志呢?

Running flutter run --release hides the logs from the terminal.运行flutter run --release隐藏终端的日志。 So how do you do?那你怎么办?

So I got one slow way:所以我得到了一种缓慢的方法:

  1. Run the app with flutter run --release使用flutter run --release运行应用程序
  2. Check that some logs are showing in macOS console app (filter logs with 'Flutter', 'Runner' or any strings you want)检查某些日志是否显示在 macOS console应用程序中(使用“Flutter”、“Runner”或您想要的任何字符串过滤日志)
  3. Then close the app, receive the notification然后关闭应用,收到通知
  4. Logs appear出现日志

With this solution you can't hot-reload the app, you have to rebuild it.使用此解决方案,您无法热重新加载应用程序,您必须重新构建它。 Mine takes 3mn to test.我的测试需要 300 万。 Not optimal but at least I've got some logs.不是最佳的,但至少我有一些日志。

You can try你可以试试

flutter run -d 'device_id' --profile

This will run your app in profile mode which is similar to release mode and provides logs in console as well.这将以类似于发布模式的配置文件模式运行您的应用程序,并在控制台中提供日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM