我正在尝试使用新的 Xcode 11.4 功能在 ios 模拟器中测试推送通知。
我的应用同时具有 NotificationService 和 NotificationContent 扩展,可以在向用户显示之前更改消息。
要向模拟器发送通知,我正在使用终端命令:
xcrun simctl push <simulator_id> <app_bundle_id> push.apns
我的 push.apns 是这样的:
{
"Simulator Target Bundle": "app_bundle_id",
"aps":{
"category": "NewOrder",
"alert": {
"loc-key": "NOTIFICATION_KEY",
"loc-args": ["3"]
},
"badge": 1,
"sound": "default",
"types": ["order.created"],
"storeId": "4616",
"mutable-content": 1,
"link": "my-app://orders/3",
"thread-id": "OrderThreadId"
}
}
我在屏幕上看到了通知,但似乎“链接”属性不起作用。当我点击推送时,在这种情况下,我希望看到第三个订单的屏幕,但我看到的是应用程序的主屏幕。
如有任何帮助,我将不胜感激。谢谢。