简体   繁体   中英

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

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 (ie 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM