I've been having trouble getting the following bit of code to work right:
It always crashes when it runs this part. So I tried it like this:
And it still crashes. So I added an NSLog:
And the NSLog shows up, which means that the timer is valid. Any idea what's going on?
Code:
for (Planet *aPlanet in planetArray) {
[aPlanet.makeShipTimer invalidate];
}
Code:
for (Planet *aPlanet in planetArray) {
if ([aPlanet.makeShipTimer isValid]) [aPlanet.makeShipTimer invalidate];
}
Code:
for (Planet *aPlanet in planetArray) {
if ([aPlanet.makeShipTimer isValid]) NSLog(@"Valid!");
}