问题
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