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
2
votes
2 answers

How to use connectionDidFinishDownloading:destinationURL: and connectionDidFinishLoading:

I have implemented both the NSURLConnectionDownloadDelegate, NSURLConnectionDataDelegate delegate methods as given below. The problem is that after connection:didReceiveResponse: , connectionDidFinishDownloading:destinationURL: is called but not…
2
votes
2 answers

NSURLConnection retry on 401 status

I'm communicating with a server that validates a password and returns a 401 error on invalid password, together with a json body specifying the number of failed attempts. That number is incremented by the server on each failed validation. The…
Mariano Ruggiero
  • 737
  • 4
  • 15
2
votes
1 answer

Is there a difference between using NSURLConnection with delegate call backs and sendAsynchronousRequest:queue:completionHandler:?

I'd like to understand what the difference is between using –initWithRequest:delegate: with delegate methods and +sendAsynchronousRequest:queue:completionHandler:. Are there some performance differences based on the number of requests, or any other…
Moxy
  • 4,162
  • 2
  • 30
  • 49
2
votes
0 answers

Asynchronous NSURLConnection leaking

I know that issue has been reported tons of times but almost all the answers concerned non ARC projects and I have been stuck for days now. I have looked in many forums and articles. I hope I could find some help here. I use an asynchronous…
2
votes
1 answer

Twitter iOS Streaming API: no data being received

I'm trying to modify Apple's sample code for using the Twitter API so that I can use the streaming API to filter tweets. I am attempting to implement the method suggested in response to this question: Does TWRequest work for the twitter streaming…
Michael
  • 41
  • 4
2
votes
1 answer

NSURLConnection's delegate method, asking for authenticationChallenge is not getting fired?

I use NSURLConnection to call a webservice and there is a client certificate present in my keychain which I set as the credential in - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge…
1
vote
2 answers

NSURLConnection delegate called in the main thread on iOS 5

I'm upgrading my iPhone application, which has the content downloading function using Http communication. The event used to occur in the main thread and the NSURLConnectionDelegate functions used to be called in the other thread on iOS 4. But when I…
1
vote
1 answer

Safe Casting, but EXC_BAD_ACCESS anyway

Disclaimer: I'm quite new to Obj-C and iOS (5, ARC enabled). The following implementation of an NSURLConnectionDelegate method creates EXC_BAD_ACCESS in the NSLog call inside the if: - (void)connection:(NSURLConnection *)connection…
Chris
  • 3,192
  • 4
  • 30
  • 43
1
vote
1 answer

Delegating with or without the need to implement a protocol.. what's the rationale behind?

I have a doubt about classes that designate a delegate. Sometimes the delegate object needs to implement a protocol, sometimes not. For example, if you want to display an UIAlertView, you create it specifying a delegate like self. Then, the class…
1
vote
3 answers

Ambiguous use of 'connection(_:didReceive:)'

static let didReceiveResponseSelector : Selector = #selector((NSURLConnectionDataDelegate.connection(_:didReceive:)) as (NSURLConnectionDataDelegate) ->(NSURLConnection,URLResponse) -> ()) This code is returning error: Ambiguous use of…
SOUA Hamza
  • 146
  • 2
  • 10
1
vote
0 answers

How to convert the exponential value to normal decimal or without exponent format in Swift?

I am getting a exponential value for the expected downloadable size in NSURLConnectionDelegate. It's showing as 1.34597e+08. Now I am trying to convert the value to 1.3459 using the below code, but with no luck: self.expectedDownloadSize =…
Saty
  • 2,563
  • 3
  • 37
  • 88
1
vote
1 answer

How to handle multiple request using NSURLConnection delegate method?

I have two webservices from which I want to parse the data, And I had coded below from which I am getting data properly. Now, my question is that If I have 10 webservices then I have to create 10 object of NSURLConnection? Its not sufficient. I am…
Dharani
  • 88
  • 15
1
vote
1 answer

NSURLConnection: Confusion with the oder in which connection:didReceiveResponse: and connection:didFailWithError: are called

This may be a very silly question!! But, as I am having a doubt, thought of asking here. Are the two delegate methods (i.e. connection:didReceiveResponse: and connection:didFailWithError:) are mutually exclusive to each other? I mean is there any…
1
vote
1 answer

NSUrlConnection Delegate methods are not getting called from helper class

I have to do SSL pinning so need to verify server side SSL certificate. SO I have to use NSURL delegates. I have a helper class in which I have created method which returns me login response: - (NSData *)sendSynchronousRequest:(NSString…
Vaibhav
  • 865
  • 2
  • 10
  • 19
1
vote
1 answer

unable to load data from webservice into id type of variable

I am trying to load data from server into id result variable, my url is working perfectly i can see data on the browser, but the data loading process is very slow(15 secs ) and the result getting Output data id result is nil Class: MyWebservices…