You can use this method:
- (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate startImmediately:(BOOL)startImmediately
More details here and delegate:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response - (void)connectionDidFinishLoading:(NSURLConnection *)connection
A delegate is an object that can respond to the two methods of receiving data above. If you want to do asynchronous, you must use a delegate. If you do not, you can simply do:
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error [More here][2]
Or you can just do this for some data:
+ (id)dataWithContentsOfURL:(NSURL *)aURL
More here
source share