Re: CodeWarrior and Objective-C warnings
Re: CodeWarrior and Objective-C warnings
- Subject: Re: CodeWarrior and Objective-C warnings
- From: John Stiles <email@hidden>
- Date: Wed, 1 Dec 2004 18:51:57 -0800
That's a great solution. So dead-simple. Thanks :)
On Dec 1, 2004, at 5:48 PM, Evan Schoenberg wrote:
An alternative option to those already presented:
Since you've tested that it responds to the selector, you could typecast like so
if ([(id)response statusCode] == 200)
and thereby not make other assumptions about the class besides whether or not it responds to statusCode, which you know it does.
-Evan
On Dec 1, 2004, at 6:42 PM, John Stiles wrote:
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
_______________________________________________
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