如何在iOS模拟器中模拟本地/推送通知? [英] How to simulate a local/push notification in iOS simulator?

查看:713
本文介绍了如何在iOS模拟器中模拟本地/推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WatchKit允许我们模拟通知.apns文件.

WatchKit allows us to simulate notifications with an .apns file.

如何在iOS应用中执行相同的操作? (最好是在模拟器中.)

How can I do the same thing in an iOS app? (Preferably in the simulator.)

我问的原因是,我希望通过通知最初启动应用程序时使调试器处于活动状态(即,我想查看application:didFinishLaunchingWithOptions:方法中发生的情况).如果我启动一个新的调试会话,它将立即调用application:didFinishLaunchingWithOptions :,然后在单击通知时我将永远无法测试该代码路径.

The reason I ask is that I want to have the debugger active when the app is initially launched via a notification (i.e. I want to see what happens in the application:didFinishLaunchingWithOptions: method). If I start a new debugging session it will call application:didFinishLaunchingWithOptions: immediately, and then I can never test that code path when I tap on the notification.

推荐答案

没有任何方法可以在模拟器中模拟通知.您可以调试到实际设备,并发送沙盒推送通知以在Xcode中实现该功能.

There isn't any way to simulate a notification in the simulator. You can debug to a real device and send a sandbox push notification to hit that function in Xcode.

这篇关于如何在iOS模拟器中模拟本地/推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆