Frage

As the question says, will the following help? I have not set any delegate to the request. Am I better off setting delegates?

request = nil;
War es hilfreich?

Lösung

No. NSMutableURLRequest can not 'run'. NSMutableURLRequest is just an object that stores url, body and some other options. To run it you should use NSURLConnection, example:

NSURLConnection* your_connection = [NSURLConnection connectionWithRequest:your_request delegate:delegate];

or NSURLSession which returns NSURLSessionTask, example:

NSURLSessionDownloadTask *sessionTask = [NSURLSession downloadTaskWithRequest:your_request];

To cancel connection/task you should call

[your_connection cancel];

or

[sessionTask cancel];

depending on what do you use.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top