问题
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:
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.
来源:https://stackoverflow.com/questions/8898307/detecting-background-app-launch-in-xcode-to-debug-a-newsstand-app