Saving task data


Last part of the iTahDoodle app is to have the array saved to disk. As I understand it, purpose of this is so that closing the app and reopening will retain the array as it was prior to closing.

But my array stick around without implementing this extra code.

Now, if I FORCE close the app, the whole thing crashes (in the simulator). But simply pressing the home button and then opening the app back up will show the retained list.

So what is that extra ‘writeToFile’ method actually doing?


I don’t have the book in front of me, but aren’t you effectively leveraging the standard backgrounding behavior of iOS? Most apps will suspend until you “launch” them again, so your app never leaves memory.

I would imagine that the simulator will use the same filesystem each time, so the real test is this: if you’re writing to a file, you can quit the simulator, start it again, and your app will still have the data that was written to disk last time. Otherwise it should start with a clean slate.

(This is all pure speculation, since I don’t remember the exercise very well at all.)


If you’d like to observe more realistic behavior, launch/test your app from within the simulator itself (rather than from Xcode).

When an app is launched into the simulator from within Xcode, the app is wrapped by an additional debugging process that doesn’t respond well to having your app quit out from under it.