简体   繁体   中英

How to pass NSError to method

I have a method which take the parameter

(void(^)(NSError*))errorCall;

I need to pass errorCall value

-(void)message{

example = [[Example alloc]init]
[example opertationError:void(^)(NSError*))errorCall ]; 
}

for the below line

[example opertationError:void(^)(NSError*))errorCall];

i need to pass some custom error call which in type of void(^)(NSError*))errorCall

Please any one let me know how to pass this kind of error value to the method.

@All

Thanks in advance

You can do like this:

void(^aBlock)(NSError *) = ^(NSError *error) {
    ...
};
[self errorValue:aBlock];

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM