Detecting background app launch in Xcode to debug a Newsstand app

与世无争的帅哥 提交于 2019-12-11 13:58:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!