我正在尝试实现块调用。这是我的方法:
- (void) runTest; {
void (^MyBlock)(id, NSUInteger, BOOL) = ^(id obj, NSUInteger idx, BOOL stop) {
NSLog(@"Video game %@", (NSString *)obj);
};
BOOL stop;
MyBlock(@"Path of exile", 0, &stop);
NSArray *videoGames = @[@"fallout", @"Deus ex",@"final fintasy"];
[videoGames enumerateObjectsUsingBlock:MyBlock];
}
但在这一行:
[videoGames enumerateObjectsUsingBlock:MyBlock];
我收到此错误:
Incompatible block pointer types sending 'void (^__strong)(__strong id, NSUInteger, BOOL)' to parameter of type 'void (^ _Nonnull)(id _Nonnull __strong, NSUInteger, BOOL * _Nonnull)'
你们中的任何人都知道我做错了什么或者我该如何解决这个问题?
我会非常感谢你的帮助。