【发布时间】:2020-09-03 10:36:05
【问题描述】:
如何在不使用 ios 设备的情况下使用 Xcode 11.4 及更高版本在 IOS 模拟器中测试推送通知。
【问题讨论】:
标签: ios xcode apple-push-notifications ios-simulator
如何在不使用 ios 设备的情况下使用 Xcode 11.4 及更高版本在 IOS 模拟器中测试推送通知。
【问题讨论】:
标签: ios xcode apple-push-notifications ios-simulator
Xcode 11.4 及更高版本支持使用模拟器测试推送通知。
为了测试,
Controlroom 是我最近遇到的一个很棒的应用程序,它允许控制模拟器。它提供了一个很好的 UI 来自定义通知。 特别感谢 Paul Hudson 分享 git 中的源代码。 Git URL - https://github.com/twostraws/ControlRoom
在终端中运行以下命令
xcrun simctl push <simulator identifier> <bundle identifier of the app> <pushcontentfile>.apns"
Xcode Menu => Window => Devices and Simulators
{
"aps": {
"alert": "Push Notifications Test",
"sound": "default",
"badge": 1
}
}
.apns 文件应包含应用程序的捆绑标识符作为有效负载的一部分
{
"Simulator Target Bundle": "<bundle identifier of the app>",
"aps": {
"alert": "Push Notifications Test",
"sound": "default",
"badge": 1
}
}
【讨论】:
xcrun simctl list | egrep '(Booted)'