Questions tagged [nsurlconnectiondelegate]

The NSURLConnectionDelegate protocol defines methods common to the NSURLConnectionDataDelegate and NSURLConnectionDownloadDelegate protocols.

The NSURLConnectionDelegate protocol defines methods common to the NSURLConnectionDataDelegate and NSURLConnectionDownloadDelegate protocols.

Delegates of NSURLConnection objects should implement either the data or download delegate protocol (including the methods described in this protocol). Specifically:

If you are using NSURLConnection in conjunction with Newsstand Kit’s downloadWithDelegate: method, the delegate class should implement the NSURLConnectionDownloadDelegate protocol.

Otherwise, the delegate class should implement the NSURLConnectionDataDelegate protocol.

Source: NSURLConnectionDelegate class reference

Useful links

167 questions
0
votes
3 answers

Wait till the delegate methods finish executing in ios

-(void)method1 { [self method2]; [self method3]; //After finishing execution of method2 and its delegates I want to execute method3 } Here method2 got running when it called but before execution of its…
Dolo
  • 966
  • 14
  • 28
0
votes
1 answer

How to get the http response for NSURLConnection without using delegates

I would like to know if there is a way to get the HTTP response for a NSURLConnection without making use of the delegate provided by Apple. For example if I setup a connection in the following manner: NSMutableURLRequest *request =…
0
votes
1 answer

Unit testing NSURLConnectionDelegate method

I want to test a method which makes URL request. When response is received in NSURLConnectionDelegate method I save the response. The logic I really want to test is whether response was saved or not. How to test NSURLConnectionDelegate…
Geek
  • 8,280
  • 17
  • 73
  • 137
0
votes
1 answer

NSURLConnection get data from redirected URL

I am using NSURLConection and its delegate methods to asynchronously get data from an online TTS api. Here is the URL I am trying to load: http://tts-api.com/tts.mp3?q=hello world The above URL redirects and give us an MP3 file which I need to…
Harikrishnan
  • 7,765
  • 13
  • 62
  • 113
0
votes
4 answers

How to wait till asynchronous request returns data before returning value

I have send asynchronous request to a website using the following code: NSMutableURLRequest *requestSiteToSendData = [NSMutableURLRequest requestWithURL:[[NSURL alloc]initWithString:@"www.example.com"] cachePolicy:NSURLRequestReloadIgnoringCacheData…
0
votes
1 answer

Common NSURLCONNECTION Failure Reasons

Is there any ways to systematically display the errors when did fail delegate is called in NSURLConnection delegate method?Is there any helper methods to find the associated error with error number returned by the delegate?
0
votes
2 answers

How to do this with AFNetworking?

I am trying to change my old 'ASIHTTP' code to AFNetworking, and stuck over this, Can some one tell me how to convert this chunk of code to AFNetworking NSString *urlString = [NSString stringWithFormat:kLogin]; NSURL *url= [NSURL…
0
votes
1 answer

Is there a way to let the user chose whether or not trust the site when we try to use NSURLConnection to connect with SSL for an untrusted cert?

There is a similar question on stack overflow. Here is my code which will accept the untrusted server certificate anyway. - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)space { …
0
votes
1 answer

Download with NSURLConnection returns empty data?

My app is downloading a file from the internet using NSURLConnection. Two problems are happening: 1) [connection didReceiveData] is never called 2) When [connection didFinishDownloading] is called, my self.currentData is empty What am I doing…
JohnWickham
  • 571
  • 1
  • 6
  • 15
0
votes
1 answer

NSURLConnection doesn't call NSURLConnectionDelegate authentication methods after an HTTP 401

I'm consume a web service that uses HTTP basic auth with an NSURLConnection. In my NSURLConnectionDelegate, I implemented –[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:], –[NSURLConnectionDelegate…
0
votes
2 answers

Stop UIACtivityIndicatorView temperamental iOS

I do a post request using Async [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) I have the call backs for when the connection has stopped…
0
votes
1 answer

NSURLConnectionDelegate's connection:willCacheResponse: randomly called

Here is the really simple call I make : NSURL *url = [NSURL URLWithString:urlString]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:500]; NSURLConnection *connection =…
greg3z
  • 601
  • 6
  • 18
0
votes
2 answers

NSURLConnection data received after connectionDidFinishLoading

I have a question about NSURLConnection: I want download an image with: NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self]; the first delegate called (correctly) is - (void)connection:(NSURLConnection…
Kappe
  • 9,217
  • 2
  • 29
  • 41
0
votes
1 answer

iOS. Do NSURLConnection and UIView's setNeedsDisplay rely on GCD for asynchronous behavior?

I am doing a lot of GCD and asynchronous rendering and data retrieval work lately and I really need to nail the mental model about how asynchronous is done. I want to focus on setNeedsDisplay and the NSURLConnectionDelegate suite of methods. Is it…
0
votes
2 answers

iOS - UIView. What are the limitations of using drawRect to do data retrieval?

For my iOS app I am implementing a "lazy" data loading scheme that is almost there, but not quite. I override my UIView subclasses drawRect method thusly: The overridden drawRect method CGContextRef context =…
dugla
  • 12,774
  • 26
  • 88
  • 136