• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSApp sendAction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApp sendAction


  • Subject: Re: NSApp sendAction
  • From: Andy Lee <email@hidden>
  • Date: Wed, 23 Nov 2005 12:32:31 -0500

On Nov 23, 2005, at 12:11 PM, Daniel Jalkut wrote:
if your portNumber is not an NSNumber, you may want to change the signature of the function so that it expects an NSNumber instead of a straight int.

To be honest I'm not really sure how dire (if at all) the consequences of sending a non-object are, but it seems like a bad idea.

I would agree it's a pretty bad idea, even if you know the argument you're passing is the same size as an id. If it "happens" to work, that is an accident of the implementation of - performSelector:withObject:withObject:. That implementation is within its rights to send a message to any of its object arguments, and if it tries that with a non-object your app will crash.


If using an NSNumber is not an option, there is still the NSInvocation route, which is more complicated but allows for non- object arguments.

--Andy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSApp sendAction (From: "Brian O'Brien" <email@hidden>)
 >Re: NSApp sendAction (From: Nick Zitzmann <email@hidden>)
 >Re: NSApp sendAction (From: j o a r <email@hidden>)
 >Re: NSApp sendAction (From: "Brian O'Brien" <email@hidden>)
 >Re: NSApp sendAction (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Mouse events and offscreen windows
  • Next by Date: Thread Safety of performSelector:withObject:afterDelay:?
  • Previous by thread: Re: NSApp sendAction
  • Next by thread: Re: NSApp sendAction
  • Index(es):
    • Date
    • Thread