Compiler error “expected method not found” when using subscript on NSArray

后端 未结 7 2025
悲哀的现实
悲哀的现实 2020-11-29 04:45

I wrote this simple code to try out the new Objective-C literal syntax for NSArrays:

NSArray *array = @[@"foo"];
NSLog(@"%@",         


        
7条回答
  •  无人及你
    2020-11-29 05:02

    If anyone gets to this old thread after getting this error in Xcode 9.3 beta 4 with some legacy Objective-C code like I did, here was my fix.

    Update:

    @property (nonatomic, strong) id myObject;
    

    To:

    @property (nonatomic, strong) NSMutableArray *myObject;
    

提交回复
热议问题