Using XCode 4.4's Convert to Modern Objective C Syntax, my [NSNumber numberWithBool:YES]
calls were converted to @(YES)
. I had some issue that I've now forgotten, and changed them myself to @YES
, which is supposed to be the correct syntax.
However, doing so gives me the error:
Unexpected type name 'BOOL': expected expression
I know that there is an "expression" syntax but I don't see why I can't simply use @YES
and @NO
.
// Compiler error:
NSDictionary *userDefaultsDefaults = @{@"hasBeenLaunched": @YES};
// No error
NSDictionary *userDefaultsDefaults = @{@"hasBeenLaunched": @(YES)};
Why does @(YES)
compile while @YES
does not, and what I can do to remedy that?