Ignoring the currentLocation
/currentGPS
confusion — no, that's still not quite right.
You don't show the the setter for currentLocation
. I'll assume it's a @synthesize
d property. If you just write currentLocation = something
, you're not invoking the property setter; you're just setting the instance variable. This means that after you release the object in the very next line, your instance variable is probably pointing to a deallocated object.
The correct way to write it (again, assuming you have a synthesized accessor) would be:
-(void)newLocationUpdate:(NSString *)text {
self.currentLocation = text;
}
This invokes the property accessor, which copies the object for you.
If for some reason you needed to access the instance variable directly (like if this were the setter method for currentLocation
), you would write:
-(void)newLocationUpdate:(NSString *)text {
[currentLocation release];
currentLocation = [temp copy];
}