简体   繁体   English

iOS Firebase 推送通知不适用于 Xcode 11.5 和 iOS 13 模拟器

[英]iOS Firebase Push notification not working on simulator with Xcode 11.5 and iOS 13

I have tried for Firebase Push notification but its not working.我尝试过 Firebase 推送通知,但它不起作用。 Remote message is displaying on console with payload but not showing the notification on simulator.远程消息显示在带有负载的控制台上,但未在模拟器上显示通知。 I using Xcode 11.5 and iOS 13.我使用 Xcode 11.5 和 iOS 13。

  1. added GoogleService-Info.plist to root folder将 GoogleService-Info.plist 添加到根文件夹
  2. did all code required for Firebase Push notification完成 Firebase 推送通知所需的所有代码
  3. uploaded .p12 file on firebase console在 Firebase 控制台上上传 .p12 文件
  4. added push notification capability on Xcode在 Xcode 上添加推送通知功能

You can follow this article for testing push notifications in the simulator.您可以按照本文在模拟器中测试推送通知。 For testing remote notifications that is sent directly from firebase you will need a physical device.要测试直接从 firebase 发送的远程通知,您将需要一个物理设备。 I am using xcode 11.6 and during the registration process it is showing a message in the console: Error! iOS Simulator does not support push! Please test on a real iOS device. remote notifications are not supported in the simulator我使用的是 xcode 11.6,在注册过程中,它在控制台中显示一条消息: Error! iOS Simulator does not support push! Please test on a real iOS device. remote notifications are not supported in the simulator Error! iOS Simulator does not support push! Please test on a real iOS device. remote notifications are not supported in the simulator

Here is the summary for testing push notification in simulator:以下是在模拟器中测试推送通知的摘要:

  • Register for push notifications and make sure you allow it.注册推送通知并确保您允许它。
  • Create a file named: test_push_notification.apns创建一个名为: test_push_notification.apns的文件
  • Add and save the following JSON in the newly created file just by replacing bundle identifier as per your app.只需根据您的应用程序替换包标识符,即可在新创建的文件中添加并保存以下 JSON。
  • { "Simulator Target Bundle": "com.yourapp.bundleid", "aps": { "alert": { "title": "Push on the simulator", "subtitle": "Test push notification", "body": "This notification will show up in the simulator!" { "Simulator Target Bundle": "com.yourapp.bundleid", "aps": { "alert": { "title": "推送模拟器", "subtitle": "测试推送通知", "body": “此通知将显示在模拟器中!” } } } } } }
  • Open terminal and navigate to the directory where you saved the file.打开终端并导航到保存文件的目录。
  • Run this command xcrun simctl push booted test_push_notification.apns运行此命令xcrun simctl push booted test_push_notification.apns

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

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