Detecting background app launch in Xcode to debug a Newsstand app

2.8k views Asked by At

I'm trying to breakpoint didFinishLaunchingWithOptions in my app delegate to capture the app being launched (in the background) when a newsstand issue download completes after the app was terminated. I believe it could happen for example if a user manually requests a download and then terminates the app.

On the info tab of the run scheme in the Xcode scheme editor there is an option to wait for the app to launch. The comment below it says that it is to be used when you want to launch your app manually. Although that isn't what I want, I have tried it anyway and not surprisingly it doesn't seem to do what I want. Does anyone else have a way of doing this?

1

There are 1 answers

4
bandejapaisa On BEST ANSWER

Wait for your.app to launch can be used to delay the launch of the debugger. Its very useful in testing newsstand updates arriving after simulating a push notification.

You can put a breakpoint on application:didFinishLaunchingWithOptions: and then trigger your push notification which will simulate a newsstand issue arriving

Remember, if you a testing - you want to ensure you don't throttle newsstand updates. In production you can only get 1 per day, so add this:

#ifdef DEBUG
    // For debugging - allow multiple pushes per day
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NKDontThrottleNewsstandContentNotifications"];
    [[NSUserDefaults standardUserDefaults] synchronize];
#endif

Is this what you were looking for? If not please elaborate.