iOS Simulator and Xcode 4


#1

I think this is an Xcode 4 issue, but I’m posting here to get confirmation.

My code (and consequently bhardy’s code from the downloadable answers) compiles just fine in Xcode 4. Run it in the simulator or on your device and everything is almost okay.

Of course, we’re testing data persistence and archiving with this chapter so you have to quit the Homepwner app from the multitasking bar (double click the home button, tap and hold on any app icon, then quit by tapping on the red minus). When performing this in Xcode 4 (either to simulator or testing on device) you get the familiar prompt that gdb has quit “(gdb)” in the console / debug area, but then if you launch the Homepwner app again from iOS spring board, it causes the main function to throw a SIGKILL exception.

I think this is an Xcode 4 specific failure, and now that I think about it, I should probably test with LLVM2 (nope same result).

The compiled app works just fine on iOS device and simulator at any point after that initial launch, quit, and SIGKILL.

Joe, do you all have any insight into this?


#2

When you open up the dock and kill an application, the OS literally sends a KILL signal to the application. The debugger doesn’t know any better, and sees the kill signal and says “Well, this is what happened…”

It is possible that Xcode 4 is getting confused and thinks the application is still running for whatever reason. I have yet to see this issue, but it also may be because I use a different approach: if you are running from Xcode, click the home button first, then click the Stop button in Xcode 4. It has the same effect (app is killed), but Xcode most definitely knows about the kill switch being flipped and the next run should be okay.