> On Nov 7, 2016, at 12:24 PM, Jens Alfke <j...@mooseyard.com> wrote: > >> On Nov 7, 2016, at 10:46 AM, Richard Charles <rcharles...@gmail.com> wrote: >> >> [doc performSelector:@selector(updateChangeCount:) >> withObject:@(NSChangeUndone) >> afterDelay:0]; > > That one definitely won’t work. The parameter to updateChangeCount: is an > integer (enum) value, not an object reference, but you’re calling it with an > NSNumber object. The value actually passed to the method will be a garbage > value based on the raw address* of the NSNumber object.
You are right, the method is passed a garbage value! I was under the mistaken assumption that the frameworks would take care of this conversion for me. (Cocoa magic has cast a spell on me.) > If you want to use a delayed-perform to call a method that takes a non-object > parameter, you have to create a new method that makes the call you want, then > invoke _that_ method using a delayed perform. That works. > (Or you could just do things the modern way, with dispatch_async and a block.) That also works. > * I’m aware that small integers don’t turn into real NSNumber objects on the > heap, rather a tagged pointer, but the result is the same: a pointer that > will result in a garbage value when interpreted as an integer. Very accurate answer Jens. Thanks so much for the help. Life is good again. :) --Richard Charles _______________________________________________ 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