I'm trying to pass an ivar pointer to a method and then place a value in that ivar.
static void placeThis(NSString *thingIn, NSString **here) {
*here = thingIn;
}
- (void) placeThis:(NSString *)thingIn inHere:(NSString **)here {
*here = thingIn;
}
- (void) place:(NSString*)thingIn {
[self placeThis:thingIn inHere:&thing];
placeThis(thingIn, &thing);
NSLog(@"How did that go? %@", thing);
}
I don't know if I have the syntax correct. I want to store thingIn
in the ivar. Current error is
passing address of non-local object to __autoreleasing parameter for write-back
Is this possible to do, and if so, how?
Note: This is considered a bad idea because it breaks encapsulation. I will use this only in a very local context.
Note: ivar is defined as __strong NSString* thing
(the strong is for clarity only).