Get rid of warning "Expression Result Unused"

You can use this line:

 [NSURLConnection connectionWithRequest:request delegate:self];

instead of:

NSURLConnection* connection = [NSURLConnection alloc];
[connection initWithRequest:request delegate:self];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"
NSURL *url = [NSURL URLWithString:URL];
NSURLRequest* request = [NSURLRequest requestWithURL:url .... ];
NSURLConnection* connection = [NSURLConnection alloc];
[connection initWithRequest:request delegate:self];
#pragma clang diagnostic pop

For a list of all the Clang Warnings you can suppress take a look here


The problem comes from the fact that method NSURLRequest initWithRequest… return an object that you don't store.

If you don't need it, you should write:

(void)[connection initWithRequest:request delegate:self];

On Xcode, you can use qualifier __unused to discard warning too:

__unused [connection initWithRequest:request delegate:self];

to inform the compiler that you deliberately want to ignore the returned value.