• 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: CodeWarrior and Objective-C warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CodeWarrior and Objective-C warnings


  • Subject: Re: CodeWarrior and Objective-C warnings
  • From: John Stiles <email@hidden>
  • Date: Wed, 1 Dec 2004 16:56:18 -0800

"statusCode" isn't mine, it's a NSHTTPURLResponse selector. The NSURLResponse being sent to the callback is actually an NSHTTPURLResponse--at least, that's the plan :)


On Dec 1, 2004, at 4:52 PM, Jeff Laing wrote:

My guess would be to make your statusCode part of a formal protocol and then use an explicit cast once you are sure that response implements the protocol.
 
Alternately, if you are going to use respondsToSelector: to test viability, you could use performSelector: to actually invoke it.
-----Original Message-----
From: John Stiles [mailto:email@hidden]
Sent: Thursday, December 02, 2004 11:43 AM
To: email@hidden
Subject: CodeWarrior and Objective-C warnings


I have code that looks like this



- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response

{

        if( [response respondsToSelector:@selector(statusCode)] )

        {

                if( [response statusCode] == 200 )

                {

                        // stuff

                }

        }

}



When I call [response statusCode] in the code above, CodeWarrior warns that "receiver cannot handle this message." Obviously this was taken care of on the previous line, but I can see how a compiler might not understand this :) How can I placate the compiler and silence the warning (other than disabling warnings)?
 _______________________________________________
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: 
 >RE: CodeWarrior and Objective-C warnings (From: Jeff Laing <email@hidden>)

  • Prev by Date: RE: CodeWarrior and Objective-C warnings
  • Next by Date: Re: CodeWarrior and Objective-C warnings
  • Previous by thread: RE: CodeWarrior and Objective-C warnings
  • Next by thread: RE: CodeWarrior and Objective-C warnings
  • Index(es):
    • Date
    • Thread