Re: removeObserver with keyPath nil
On 20 Nov 2012, at 19:50, Fritz Anderson fri...@manoverboard.org wrote: On 20 Nov 2012, at 11:16 AM, Gordon Apple g...@ed4u.com wrote: What¹s the story on removeObserver:self forKeyPath:nil, called in dealloc? Supposedly, this works. The docs don¹t say you can¹t use nil. However, I have run into at least one place where did not work. We converted from GC to ARC and have a bunch of these. I have seen statements that it worked under GC, but possibly not otherwise. Could you clarify what you mean by supposedly, this works? If the documentation says you can't do it, then Apple does not suppose it works, and Apple is the only one whose suppositions matter. At one time, you liked the undocumented behavior you got, but that doesn't guarantee Apple will always deliver it. The documentation of this method for the collection classes explicitly forbids the use of nil. For what it's worth, the collection classes also tell you not to call the method on them at all. Methinks somebody on the docs team did a bit too much copy and paste. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: removeObserver with keyPath nil
On 20 Nov 2012, at 11:16 AM, Gordon Apple g...@ed4u.com wrote: What¹s the story on removeObserver:self forKeyPath:nil, called in dealloc? Supposedly, this works. The docs don¹t say you can¹t use nil. However, I have run into at least one place where did not work. We converted from GC to ARC and have a bunch of these. I have seen statements that it worked under GC, but possibly not otherwise. Could you clarify what you mean by supposedly, this works? If the documentation says you can't do it, then Apple does not suppose it works, and Apple is the only one whose suppositions matter. At one time, you liked the undocumented behavior you got, but that doesn't guarantee Apple will always deliver it. The documentation of this method for the collection classes explicitly forbids the use of nil. The documentation for NSKeyValueObserving forbids it only implicitly: nil can't be a relative key path that the observer has registered. If it were permitted, the documentation would say what the method would do if you passed nil. I assume that means the use of nil is undefined at best, and they forgot to say so. (Or it's defined, and they forgot to document it — but your experience proves that isn't so.) Documentation bug filed. — F -- Fritz Anderson -- Xcode 4 Unleashed: 4.5 supplement in the works -- http://x4u.manoverboard.org/ ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com