In my app I have a few VCs that need to receive NSNotifications from my model, which is fetching data asynchronously. The problem is that the VCs disappear from time to time and when the model finishes fetching data and tries to send a notification to a VC that is already gone, the app crashes. Is there an option to prevent this crashing? Like telling NSNotificationCenter "it's ok if the observer is not there"?
:)
// Subscribe for notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(finishedLoading) name:@"Finished Loading" object:nil];
// Model sends a notification to a subscribed VC
[[NSNotificationCenter defaultCenter] postNotificationName:@"Finished Loading" object:nil userInfo:nil];