开发者

When does applicationDidFinishLaunching run on IPhone simulator?

In an IPhone app, I put a breakpoint in appDidFinishLaunching, and when I invoked the program from the compiler using command-Return, the code stopped at my breakpoint.

Then I shut down the program, but not the simulator. When I then invoked the program from the program icon, the code did not stop at my breakpoint. The breakpoint was not within any conditional scope.

Any ideas as to what's going on he开发者_JAVA技巧re?

Thanks,

John Doner


The breakpoint is something that only the debugger is aware of, and only launching your program from Xcode invokes the debugger. "Run and Debug" launches both your application and gdb (the debugger that Xcode uses) and connects them together. When the debugger sees that you have reached the execution point referenced by your breakpoint, it stops execution of the application. The application itself has no idea about the breakpoint.

If you launch your app from the Simulator (or a device) directly, the debugger isn't running, and so your breakpoint has no effect. It isn't part of the compiled app in any way.


Educated guess: breakpoint wasn't active when you invoked your application from the program icon. In order to hit a breakpoint, your app has to be started from Xcode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜