I’ve been working on something all evening and night, which I’m pleased to say has finally found (some degree of) success, but not until after two hours of puzzling over this:
NSNumber* myNum = [NSNumber numberWithFloat: 1.5];
The above code appears to work, but when I run a loop containing it, the application locks up and sends me back to the debugger.
NSNumber* myNum = [[NSNumber alloc] initWithFloat: 1.5];
This code, on the other hand, causes no problems whatsoever. I assume that +numberWithFloat allocs, so IDGI.
This has only just occurred to me: in the first example am I supposed to init the retrieved value too? i.e.
NSNumber* myNum = [[NSNumber numberWithFloat: 1.5] init];
But then what’s the point of +numberWithFloat if the alternative will do the same thing in less characters?
Maybe I’m just being really thick here