我想更新 XCode 版本。
但是在更新时,我收到了几个编译器错误。与此相同:
id<MyProtocol> objectToDelete = group[index.unsignedIntegerValue];
在“id”类型的对象上未找到读取数组元素的预期方法
id<MyProtocol> _Nonnull group
@protocol MyProtocol <NSObject>
@property (copy, nonatomic) NSString* name;
@property (copy, nonatomic) NSString* id;
@property (copy, nonatomic) NSString* internalType;
@property (strong, nonatomic) NSMutableArray<id<SomeAnotherProtocol>>* objects;
- (instancetype)initWithObject:(MyProtocol*)object;
// Search
- (BOOL)isContainsObjectWithID:(NSString*)myID;
- (NSUInteger)indexForObjectID:(NSString*)myID;
- (id<SomeAnotherProtocol>)objectWithID:(NSString*)myID;
- (NSString*)groupID;
@end
此错误仅出现在 XCode 9.3 版本上。
难道id<MyProtocol> objectToDelete = ((NSArray *) group)[index.unsignedIntegerValue];
唯一的解决办法?