Assuming self is also subclass of UIViewController, I do understand that all the UI methods of self, need to be performed inside main thread.
Consider the code given below:
- (void)someMethodWhichMayOrMayNotBeInMainThread {
// perform some function
MyController * __weak weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
MyController *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf updateListView];
});
}
In this case, if I do not give a weak reference to self, will it make a difference?
This method in itself may be called asynchronously, so the self in it might or might not be a strong reference to the weak reference to self.
Now, say the self is deallocated in the main thread already, then even if I do not assign the self in this method weakself, will it crash?