I looked through your source code and found the problem. You're trying to set the numberOfMatchingCards
property on self.game
while you're in the middle of lazily loading game
, creating an infinite loop. Your self.game.numberOfMatchingCards
is going to try to load a new game since you haven't finished instantiating the game by the time your setter is called. Just change
- (IBAction)cardModeChanged:(UISegmentedControl *)sender {
switch ([sender selectedSegmentIndex]) {
case 0:
self.game.numberOfMatchingCards = 2;
break;
case 1:
self.game.numberOfMatchingCards = 3;
break;
default:
self.game.numberOfMatchingCards = 2;
break;
}
}
to
- (IBAction)cardModeChanged:(UISegmentedControl *)sender {
switch ([sender selectedSegmentIndex]) {
case 0:
_game.numberOfMatchingCards = 2;
break;
case 1:
_game.numberOfMatchingCards = 3;
break;
default:
_game.numberOfMatchingCards = 2;
break;
}
}
I'm not sure this will solve your bad access issue, but it's the cause of the many entries in the debug navigator. Let me know if you still have the bad access issue after fixing this. It's important to remember that even though you're using ARC, objects still get released (when their reference counts drop to zero).