Reputation: 4409
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
Upvotes: 0
Views: 207
Reputation: 20163
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
}];
Upvotes: 3