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?
NSErrorin anNSValue? - rmaddyNSError**and pass the wrapped NSValue as the argment , then call performSelector:withObject , - Leem.finNSErrorwithNSValuejust to pass it toperformSelector:withObject:? There's no need to wrap it. 2) Why do you need to useperformSelector:withObject:? There's always a better way than that. I suggest updating your question with more specific details about what you really need to accomplish so people can offer better advice. - rmaddy