如何在iOS XCode 11.4的模拟器中测试FCM推送通知?

问题描述:

是否可以在模拟器中测试fcm iOS推送通知,或者可以将fcm推送通知json格式转换为apns格式以在模拟器中进行测试?

Is possible to test fcm iOS push notification in simulator or can I convert fcm push notification json format to apns format for testing in simulator?

是的,如果使用Xcode 11.4或更高版本,则可以在模拟器上测试推送通知.

Yes you can test push notifications on the simulator if using Xcode 11.4 or higher.

"Simulator支持模拟远程推送通知,包括 后台内容获取通知.在模拟器中,将 APNs文件到目标模拟器上.该文件必须是带有以下内容的JSON文件: 有效的Apple Push Notification Service有效负载,包括"aps" 钥匙.它还必须包含一个*的模拟器目标捆绑包",其中包含 与目标应用程序的分发包标识符匹配的字符串值.

"Simulator supports simulating remote push notifications, including background content fetch notifications. In Simulator, drag and drop an APNs file onto the target simulator. The file must be a JSON file with a valid Apple Push Notification Service payload, including the "aps" key. It must also contain a top-level "Simulator Target Bundle" with a string value matching the target application‘s bundle identifier.