How to enable the new Objective-C object literals on iOS?

Viewed 9376

When I create a new project with Xcode 4.4 and add these lines:

NSDictionary *test = @{ @"key" : @"test value" };
NSString *value = test[@"key"];
NSLog(@"value is: %@", value);

it compiles with no warnings and executes as expected.

Adding the same lines to an existing project produces the compiler error:

NSString *value = test[@"key"]; <-- Expected method to read dictionary element not found on object of type 'NSDictionary *'

I compared both projects' target build settings but nothing leapt out at me.

Update: The new project that successfully compiled was for OSX. I tried another new one for iOS with the above lines and it fails to compile, same as my pre-existing (iOS) project.

1 Answers
Related