I would like to test how my app behaves when the app is quit and the user taps a notification in notification center so that my app is launched. In - didFinishLaunchingWithOptions
you can check for the key UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
but how can I debug this?
If i start running the app in Xcode then I quit the app it will lose the connection to Xcode.
If you set your Xcode Scheme to launched manually (Edit Scheme > Run > Info), then you can stop running your app after you've scheduled your UILocalNotification
.
Then if you run your application again, it won't launch until you launch it from the simulator/device.
Then you could wait for the notification to fire and click the notification which then launches your app (manually!). That way you can debug that UILocalNotification
from the launchOptions
of application:didFinishLaunchingWithOptions:
Just note that for debugging, you'll probably want to schedule your UILocalNotification
for a date about 10 seconds or so in the future, it's always a pain to debug time related stuff.
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With