Xcode 4 warning "Expression result unused” for NSURLConnection

Solution 1:

When a function returns a result that you don't need you can cast it to void to eliminate the compiler warning:

(void) [[NSURLConnection alloc] initWithRequest:request delegate:self];

I haven't used ARC yet so I can't say if this is a good idea, before ARC you would need to keep this pointer result somewhere so you could release it.

Solution 2:

progrmr's answer is correct, but here's an even cleaner way to do it:

[NSURLConnection connectionWithRequest:request delegate:self];

This doesn't cause a warning, even if you don't cast the result to void.