Search code examples
iosnsurlconnectionnsmutabledata

Warning at didReceiveDate method from NSURLConnection


At following method the compiler is showing a warning.

buffer is a NSMutableData declared in the header file.

This is the warning message:

 Local declaration of 'data' hides instance variable

And this is the method which throws the warning:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [buffer appendData:data];
}

Solution

  • The compiler is confused with which data property should use in appendData method. Make sure you only have one property with name data in that scope.