Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift can';t在ios设备上模拟推送通知_Swift_Xcode_Push Notification_Apple Push Notifications_Apn - Fatal编程技术网

Swift can';t在ios设备上模拟推送通知

Swift can';t在ios设备上模拟推送通知,swift,xcode,push-notification,apple-push-notifications,apn,Swift,Xcode,Push Notification,Apple Push Notifications,Apn,我一直在关注一篇关于推送通知入门的raywenderlich.com文章,因为我想在我的应用程序上试用它,并且能够轻松地跟进,直到您在终端中运行命令并实际模拟通知为止 当我运行命令xcrun simctl push'device identifier here'site.bundleidentifier.example eventnotification.apn时,我收到一个错误,提示无效设备:“device identifier here'。我似乎无法解决问题,我直接从Xcode获得了标识符。

我一直在关注一篇关于推送通知入门的
raywenderlich.com
文章,因为我想在我的应用程序上试用它,并且能够轻松地跟进,直到您在终端中运行命令并实际模拟通知为止

当我运行命令
xcrun simctl push'device identifier here'site.bundleidentifier.example eventnotification.apn
时,我收到一个错误,提示
无效设备:“device identifier here'
。我似乎无法解决问题,我直接从Xcode获得了标识符。我进入窗口->设备和模拟器->设备,抓取了我手机的识别码。我似乎不知道如何解决这个错误,如果有人知道我如何解决这个问题,那就太好了,谢谢


文章链接:

听起来你可能正试图用你的手机来实现这一点。此命令指推送到模拟器(
simctl
是控制模拟器的命令行应用程序)

您可以通过执行以下终端命令列出可用设备:

xcrun simctl list 'devices' 'booted'
一个很好的技巧就是使用
booted
来使用开放式模拟器。因此,示例命令可能是:

xcrun simctl push booted com.myprogram.app payload.json
或者,如果要使用完整的设备ID:

xcrun simctl push 'xxxxxxx-7C2B-4B0D-A0E2-xxxxxxxxx' com.myprogram.app payload.json

用设备ID替换单引号中的信息。

哦,好的,我明白了,有没有任何命令可以用于实际的ios设备而不是ios模拟器?之后我就在模拟器上试过了,效果很好@JNPDX我并没有意识到我的错误,我一直在往下读,看到了将通知推送到真实设备的一部分,这和这个问题无关@jnpdxYeah,这个设备是另一个野兽。如果这个答案仍然澄清了一些事情,或者帮助,请考虑它的投票。