How to simulate a local/push notification in iOS simulator?

荒凉一梦 提交于 2020-01-04 17:01:26

问题


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

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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/31864651/how-to-simulate-a-local-push-notification-in-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!