However the user can quit the controller already and i don't know how to check if my success() owner still exists.
What do you mean if the owner "still exists"?
self
is retained by the block. That means that the "owner" will "still exist" as long as the block exists. So if you call success()
and the controller is no longer showing, well, it will reloadMyView
, which (depending on what your functions do) will "reload" a view that is no longer showing. Which probably doesn't matter.
What if you want to not call reloadMyView
at all? Well, you can let the block capture a weak reference to the "owner". That won't prevent it from being deallocated as it normally would. Then, when you call the success block, and the object is deallocated, the weak reference you are using will have value nil
, and sending a message to nil
does nothing.
You can choose which way you want.