> On Sep 21, 2016, at 8:00 PM, Slipp Douglas Thompson
> <apple+cocoa-...@slippyd.com> wrote:
>> On Sep 21, 2016, at 17:01 , Graham Cox <graham....@bigpond.com> wrote:
>>> This should be: if([(NSString*)context
>> Actually, this is not a good idea either, because *other* observations —
>> ones you don’t control — might use a value that’s not an object, or not even
>> a valid pointer.
I see your point about context plausibly not being neither an NSObject nor nil.
While you could check if context is an NSObject beforehand (is there even a
reliable way to do this? CocoaWithLove
couldn't find a great approach ;-/)— I think coding consistently against all
other addObserver: calls in your app is a good-enough solution. I.E. If you
implement observeValueForKeyPath: with [context isEqual: …] checks, make sure
all the other addObserver: calls (for those same keys, at least) are using nil
Cocoa-dev mailing list (Cocoaemail@example.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:
This email sent to arch...@mail-archive.com