0

Is it ok to send one notification (by one I mean the same postNotificationName: postNotificationName:@"notification_name") in multiple classes? Observer is the AppDelegate.m and it is sharing NSDictionary. Before every class send Notification it is setting value in dic for it key. After AppDelegate receives notification it is checking whether all values in dict are set to yes (all notifications were sent). Is it good method or should I use some other technique?

(Notifications for every classes are send exactly one for each class)

lvp
  • 2,078
  • 18
  • 24

1 Answers1

0

It is possible, but it is not clear what you want to achieve with this design.

The purpose for notifications is really to make sure that no crash occurs when the listener has been deallocated and does not exist any more. In the case of your app delegate this is impossible, so you should communicate with the app delegate directly (e.g. via an exposed method).

Mundi
  • 79,884
  • 17
  • 117
  • 140
  • Thanks for the help, I abandoned notifications in favor of simple exposed method as you said. Simple and easier to debug, thanks! :) My goal was to load new view controller when all data load (when some class download it's data it's sets dictionary and launch method to check if all values in dictionary are set to proper value. – lvp Feb 20 '13 at 09:15