kiran
kiran

Reputation: 4409

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

Upvotes: 1

Views: 55

Answers (1)

Anoop Vaidya
Anoop Vaidya

Reputation: 46563

You can do like this:

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

Upvotes: 1

Related Questions