In my project, I have a function like this:
- (void)doSomething:(NSError**)error {
...
}
I need to call this function on another thread by using function performSelector:onThread:withObject:waitUntilDone: , something like this:
[self performSelector:@selector(doSomething:) onThread:anotherThread withObject:??? waitUntilDone:NO];
But the function parameter is of type NSError**
. I am considering refactor the parameter type of function -(void)doSomething:
from NSError**
to NSValue*
and pass NSValue*
type as argument.
Which means, I need to wrap the &error
(which is of type NSError **
) into a NSValue
and pass it as argument, and unwrap it later. How to wrap & unwrap NSError**
with NSValue
class?