I get the warning Incompatible pointer types assigning to 'NSHTTPURLResponse *' from 'NSURLResponse *' in the code below. This method is part of Sharekit.
The line with the warning is the bolded/italicized one:
- (void)connection:(开发者_如何学GoNSURLConnection *)aConnection didReceiveResponse:(NSURLResponse *)aResponse
{
if (response)
[response release];
***response = [aResponse retain];***
[responseData setLength:0];
}
Someone please help!
Thanks!
To the compiler, aResponse
, and the result of [aResponse retain]
, is an NSURLResponse. However I'm guessing response
is an NSHTTPURLResponse. Since NSURLResponse is a superclass of NSHTTPURLResponse, you can't just assign directly — but you can use a cast to remove the warning:
response = (NSHTTPURLResponse *)[aResponse retain];
精彩评论