views:

142

answers:

2

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 here?

Thanks,

John Doner

A: 

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.

Andrei Maksimenka
A: 

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 see 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.

Mark Cogan