I find this helps to think of a pointer as an integer. (What it is.)
Look at your example using int.
-(BOOL)someMethodWithError:(int)error { error =100; return NO; }
This integer is passed by value. after this function is called an error, it will not change.
error = 123; [self someMethodWithError:error];
A pointer is the same thing. It passes by value.
NSError * error; //this assigns this to a value in memory. NSLog(@"%p",error); [self someMethodWithError:error]; NSLog(@"%p",error); // the value of error will not have changed.
if you want the pointer to change, you need to send a pointer to that pointer and change it. This is confusing, but draw a memory chart and think about it. :)
madmik3
source share