Question

1) I declare a NSNumber property is a view controller header file @property NSNumber *myNumber; 2) I set that property to a NSNumber literal and log the output:

self.myNumber = @9;
NSLog(@"myNumber is: %@", self.myNumber);

3) The above works as expected. Then I change the @9 to @10. and run the program. It does not work, the property is still set to a value of 9.

4) I make a small change to the NSLog text (a space, a full stop, anything) then rerun the program. It now does work! (updating to the new value, e.g. @10)

Any thoughts on why this is happening would be MUCH appreciated, thanks

Was it helpful?

Solution

Sometimes, Xcode gets stuck on little things like this. When something weird like this happens, the first thing to try is a clean - CmdshiftK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top