问题
can someone help me setup my debug environment so things will make more sense?
at some point the simulator stopped loading an app i'm working on. the app loads well if i run it with instruments and works well on the device (iPad).
the application tries to load and all of a sudden i get a 'debugging terminated' message at the bottom left of xcode.
running 'tail -f /var/log/system.log' i found the following message: " myApp failed to launch in time".
poking around and experimenting with breakpoints, i was able to pin point the culprit to this method:
- (BOOL)application:(UIApplication *)
application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
this method is part of the app delegate naturally, and the first thing it does is execute:
[window addSubview:viewController.view];
so my questions - how can i figure out what the hell is going on here and which part of my app is hanging?
moreover, what kind of setup can be used to get useful information from the debugger...
whenever there is an error, i cannot even figure out the line of code that generated it.
thanks.
回答1:
If your app failed to launch in time, means your app is doing something time consuming at launch time in this method
(BOOL)application:(UIApplication *) application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
if you exceed a period of time and still not launched, your application automatically terminated. So you could review your codes and make some of them run in background after your app has finished launching. Cheers.
来源:https://stackoverflow.com/questions/4798248/debugging-failed-to-launch-in-time-with-xcode