On Aug 25, 2009, at 8:46 AM, Jason Foreman wrote:


On Aug 24, 2009, at 10:26 PM, Michael de Haan wrote:

-applicationWillTerminate: doesn't magically get called.
NSApplication posts this notification to the default notification
center.  NSApplication also automatically signs its delegate up for
this notification.


Kyle, from the "Cocoa Fundamentals Guide": "Although you can dynamically change the delegate, only one object can be a delegate at a time. Thus if you want multiple objects to be informed of a particular program event at the same time, you cannot use delegation."

So, if I understand you and the documentation correctly , even though I had implemented the delegate of NSApplication in **both** of my classes, **only** one of those classes will respond to "applicationWillTerminate:" at a time. If this is indeed correct, then I need to rethink the design of my application, and you have already suggested how to do this.



True, only one object can be the application delegate at any one time. However, multiple objects can be subscribed to application notifications, and the notification will be sent to all subscribed objects when it is posted.



Jason....I will re-read those, but your insight has clarified something that was confusing. Much appreciated.





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to