I wrote this simple code to try out the new Objective-C literal syntax for NSArray
s:
NSArray *array = @[@"foo"];
NSLog(@"%@", array[0]);
The first line works fine, but the subscripting results in an error:
Expected method to read array element not found on object of type 'NSArray *'
Just wondering if I have done something wrong, or if the literals haven't been fully implemented yet. I'm compiling with Apple LLVM 4.0 and using the iOS 5 SDK.
Here's a screenshot of the error, too.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…