Tometoyou
Tometoyou

Reputation: 8386

Should I be using KVO or NSNotificationCenter?

I have a CoreLocation singleton that has a location property. When I have retrieved the location I need to notify other controllers that the location has been received. However, I'm torn between using Key Value Observing and NSNotificationCenter. I currently have it set up as using KVO, but it seems to crash when the KVO property is nil. Which is the best way to do this?

Upvotes: 1

Views: 177

Answers (1)

matt
matt

Reputation: 535890

KVO is extremely tricky and hacky (and, as you've discovered, easy to crash). Where possible, and especially where (as here) your goal is to broadcast anonymously, use a notification.

Upvotes: 2

Related Questions