• 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: How to avoid warning with objc_msgSend
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid warning with objc_msgSend


  • Subject: Re: How to avoid warning with objc_msgSend
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 4 Oct 2004 21:32:00 -0700


On Oct 4, 2004, at 5:11 PM, Ryan Norton wrote:

Hi,

When I use objc_msgSend with something that doesn't exist on 10.2 but exists on 10.3 on a 10.2 system, I get a "selector not recognized" warning in the console every time I call it -

objc_msgSend(GetNSView(),@selector (getRectsBeingDrawn:count:),&rects,&countRects);

Is there something better to use in this circumstance than objc_msgSend?  Is there a way to turn off this warning?  Or is an #ifdef required in this circumstance?

It's pretty unusual to call objc_msgSend() yourself.  What are you trying to do?

Anyhow, assuming that GetNSView() is a function returning a pointer to an NSViewInstance, why don't you just send it normally?

id aView = GetNSView();
NSRect *rects;
int rectCount;
[aView getRectsBeingDrawn:&rects count:&rectCount];

Or, if you just want to silence the warning, make sure you've imported a header that declares -getRectsBeingDrawn:count: before you get to that line, or just replace

@selector(getRectsBeingDrawn:count:)

with

NSSelectorFromString(@"getRectsBeingDrawn:count:")

HTH,

-jcr




On Oct 4, 2004, at 5:11 PM, Ryan Norton wrote:

Hi,

When I use objc_msgSend with something that doesn't exist on 10.2 but exists on 10.3 on a 10.2 system, I get a "selector not recognized" warning in the console every time I call it -

objc_msgSend(GetNSView(),@selector (getRectsBeingDrawn:count:),&rects,&countRects);

Is there something better to use in this circumstance than objc_msgSend?  Is there a way to turn off this warning?  Or is an #ifdef required in this circumstance?

It's pretty unusual to call objc_msgSend() yourself.  What are you trying to do?

Anyhow, assuming that GetNSView() is a function returning a pointer to an NSViewInstance, why don't you just send it normally?

id aView = GetNSView();
NSRect *rects;
int rectCount;
[aView getRectsBeingDrawn:&rects count:&rectCount];

Or, if you just want to silence the warning, make sure you've imported a header that declares -getRectsBeingDrawn:count: before you get to that line, or just replace

@selector(getRectsBeingDrawn:count:)

with

NSSelectorFromString(@"getRectsBeingDrawn:count:")

HTH,

-jcr






John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html


_______________________________________________
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
  • Follow-Ups:
    • Re: How to avoid warning with objc_msgSend
      • From: Ryan Norton <email@hidden>
References: 
 >How to avoid warning with objc_msgSend (From: Ryan Norton <email@hidden>)

  • Prev by Date: Help with crashing cocoa/CoreFoundation app
  • Next by Date: Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method)
  • Previous by thread: Re: How to avoid warning with objc_msgSend
  • Next by thread: Re: How to avoid warning with objc_msgSend
  • Index(es):
    • Date
    • Thread