Alexandr Kurilin
Alexandr Kurilin

Reputation: 7845

Are the new object literals backwards compatible with iOS 5?

I'm trying to figure out if I should start using the recently added object literals to subscripting dictionaries, arrays and so on. This following post seems to indicate that iOS5 doesn't support them, and I read that the functionality was added in iOS6.

Is that the case? Is anybody using the new literals in iOS5 successfully?

Upvotes: 9

Views: 1742

Answers (2)

rob mayoff
rob mayoff

Reputation: 385600

You can find details about which versions of iOS (and OS X) support which modern Objective-C features in Apple's Objective-C Feature Availability Index.

The NSNumber, NSDictionary and NSArray literals (e.g. @{ @"key": @"value" }) can be deployed to every iOS release, including iOS 5.

The NSDictionary and NSArray subscripting operators (e.g. myArray[7] or myDictionary[@"hello"]) can be deployed to iOS 5.0 and later releases.

Upvotes: 11

BoltClock
BoltClock

Reputation: 723598

If you're using Xcode 4.5 to build your sources, then yes, they're compatible with iOS 5 as long as you use the latest LLVM compiler and you build against iOS SDK 6.0.

Upvotes: 10

Related Questions