Can you modify self from an instance method called from a weak self pointer within a block?
-(void)someMethod:(AnotherClassName *)anObject {
__weak MyClassName *weakSelf = self;
[anObject requestSomethingWithCompletion:^{
[weakSelf updateSomething];
}];
}
-(void)updateSomething {
self.something = @"update"; // Will this cause a memory leak?
}
So basically I am calling an instance method from the same class I am in, but I am doing it from a weak pointer and then changing self
.
According to Apple's Programming with Objective-C Guide this is how to call a method on self
within a block but it isn't clear weather I can directly modify self
in that method.
If you know the answer based on something you've read before please include the source.
Thanks!