xcode 11 以后可以在模拟器上测试接收通知
{
"Simulator Target Bundle": "替换为项目的Bundle identifier",
"aps": {
"alert": {
"title": "通知标题",
"subtitle": "通知副标",
"body": "通知详细信息"
},
"badge": 1,
"sound": "default"
},
"extras": {
"notification_type": "4",
"product_code": "1401",
"index_code": "00"
}
}
注意修改替换为项目的Bundle identifier
文件保存为 **.apns 比如push.apns
在终端执行
xcrun simctl push booted /Users/mac/Desktop/push.apns
/Users/mac/Desktop/push.apns 是文件的保存路径
或者直接扔进模拟器
就可以收到推送消息了