> On Apr 19, 2016, at 2:07 PM, Jens Alfke <[email protected]> wrote: > > Anyway, I can’t remember if anyone gave a solution to the question. The right > way to do this is to create a new method that takes an NSNumber, and invoke > _that_ method using the delayed-perform, after boxing the BOOL. Then the new > method can call the original method with the unboxed BOOL value.
Or, use NSInvocation: BOOL someBool = …; SEL selector = @selector(myMethod:); NSMethodSignature *sig = [self methodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig]; [invocation setArgument:&someBool atIndex:2]; [invocation invokeWithTarget:self]; Not pretty, but it works. The *best* solution is probably to see if there’s a way to move away from performSelector: in the first place, possibly by moving towards a blocks-based approach. This is more future-proof, too, since a lot of this Obj-C dynamic stuff isn’t available in Swift, so you’ll have to redesign it all if you decide to go that direction at some point. Charles _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
