Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using MPMoviePlayerController in a project. The loadState of the MPMoviePlayerController object is observed using NSNotificationCenter.

Why did Apple choose NSNotificationCenter in this situation instead of using delegation?

share|improve this question
up vote 3 down vote accepted

You may have more than one class that is interested in the loadState of the MPMoviePlayerController. A plausible example of this is the fact that Apple may be using the loadState-related notification to do some of their own stuff under the hood. Now you come along and also express interest in the same notification. Using NSNotificationCenter, you both can say "Hey, I want to be notified when the loadState of this player changes".

In the case of a protocol (delegation), it's generally a one-to-one relationship. An object, in your example the player, could only have one delegate. So if Apple needed to know about the loadState, and you needed to learn about the loadState also, one of you would be out of luck!

NSNotificationCenter has what's considered a "loosely coupled" relationship with the object that posts a notification and the object(s) that observes that notification. In delegation, however, the relationship tends to be significantly tighter.

share|improve this answer
Absolutely correct IMHO – drekka Aug 7 '12 at 3:31
Based on what? If you're going to give your "honest" opinion, you should explain why. – jmstone Sep 5 '12 at 18:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.