How to pass the parameter
-(void)errorValue:(void(^)(NSError*))error{
[self errMssg];
}
-(void)call{
(void(^)(NSError*))error;
[self errorValue ?];
}
Please let me know how to pass (void(^)(NSError*))error to the method!
@All Thanks in Advance
You need to properly declare a block variable first. Then you just pass it by name like any other variable:
void(^myBlock)(NSError *) = ^(NSError* error) {
// Do something
};
[self errorValue:myBlock];
Alternatively, you can pass a block literal directly:
[self errorValue:^(NSError* error) {
// Do something
}];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.