I’m on p. 271 in the book, trying to test my changes just before moving into the “More on Low-Memory Warnings” section. I have the deployment target set for 4.2, since that’s what my iPhone is running, and Devices is set to Universal. I’ve successfully tested on the iPad 4.2 and iPad 4.3 simulators and the iPhone 4.2 and 4.3 simulators. But on my iPhone, as soon as I touch the “add” button, the app crashes in PossessionStore -createPossession, on the line [allPossessions addObject:p];. The crash is "Program received signal “EXC_BAD_ACCESS”. Here’s the first part of the backtrace:
(gdb) bt #0 0x32716464 in objc_msgSend () #1 0x00004788 in -[PossessionStore createPossession] (self=0x14a840, _cmd=0x6eb6) at PossessionStore.m:61 #2 0x00003450 in -[ItemsViewController addNewPossession:] (self=0x145e70, _cmd=0x6d35, sender=0x12d0f0) at ItemsViewController.m:62 #3 0x3207afec in -[NSObject(NSObject) performSelector:withObject:withObject:] () #4 0x323b3ea4 in -[UIApplication sendAction:to:from:forEvent:] () #5 0x3244f160 in -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] () #6 0x3207afec in -[NSObject(NSObject) performSelector:withObject:withObject:] () #7 0x323b3ea4 in -[UIApplication sendAction:to:from:forEvent:] () #8 0x323b3e44 in -[UIApplication sendAction:toTarget:fromSender:forEvent:] () #9 0x323b3e16 in -[UIControl sendAction:to:forEvent:] ()
The allPossessions array and the new possession p both exist and look good. So what’s wrong?