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
35
votes
4 answers

NSUrlConnectionDelegate - Getting http status codes

in iOS, how can I receive the http status code (404,500 200 etc) for a response from a web server. I am assuming it's in the NSUrlConnectionDelegate. Objective-C or Monotouch .NET answer ok.
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
19
votes
1 answer

How to know if a NSURLResponse comes from cache?

I set NSURLCache on a specific folder (../../Application Support/Offline so it won't be deleted randomly by the OS), then I send a NSURLRequest with NSURLRequestReturnCacheDataElseLoad policy. How can I tell that the response, handled by a class…
14
votes
8 answers

The certificate for this server is invalid

I know that if I use following nsurlconnectiondelegate it will be fixed – connection:willSendRequestForAuthenticationChallenge: – connection:canAuthenticateAgainstProtectionSpace But I am trying to use…
pa12
  • 1,493
  • 4
  • 19
  • 40
12
votes
1 answer

Cancel NSURLConnection started with sendAsynchronousRequest:queue:completionHandler:?

Is it possible to cancel an NSURLConnection started with sendAsynchronousRequest:queue:completionHandler:? Why doesn't sendAsynchronousRequest:queue:completionHandler: return the NSURLConnection object it creates so that I can cancel it?
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
11
votes
6 answers

how to unit test a NSURLConnection Delegate?

How can I unit test my NSURLConnection delegate? I made a ConnectionDelegate class which conforms to different protocols to serve data from the web to different ViewControllers. Before I get too far I want to start writing my unit tests. But I don't…
Moxy
  • 4,162
  • 2
  • 30
  • 49
11
votes
4 answers

NSURLConnectionDownloadDelegate file issue

Now that 5.0 is launched and we can discuss it without breaching Apple's NDA, I have an issue with the new version of NSURLConnection. This has a new delegate, NSURLConnectionDownloadDelegate with two key…
millport
  • 2,411
  • 5
  • 23
  • 19
11
votes
5 answers

React Native Fetch Request Fails

I am using the react native Fetch API to get JSON data from https://api.github.com/users/{username} but the request fails with the following error message. "TypeError: Network request failed {stack: (...), message: 'Network request failed'}". I…
sanjeev
  • 507
  • 1
  • 6
  • 11
9
votes
2 answers

Why NSURLConnection failed with Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." in Swift iOS8?

I use Xcode beta6. I created an app which have a Downloader class, and this is the Downloader class: class Downloader : NSObject { private var _connection : NSURLConnection? private var _downloadedData: NSMutableData? func…
szuniverse
  • 1,076
  • 4
  • 17
  • 32
8
votes
1 answer

FreePascal / Lazarus and implementing nsurlconnectiondatadelegate

I am trying to implement nsurlconnectiondatadelegate as I need to support async mode - in synchronous mode redirects are followed automatically which I do not want. For reference I have the code working in synchronous mode with urlRequest etc. The…
Tom
  • 3,587
  • 9
  • 69
  • 124
8
votes
3 answers

iphone: secure restfull server "The certificate for this server is invalid

I am trying to consume secure restful service which gives error Error = Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xxx.xxx.xxx.xxx” which could…
Azhar
  • 20,500
  • 38
  • 146
  • 211
6
votes
2 answers

Asynchronous NSURLConnection on separate thread fails to call delegate methods

I am running a NSURLConnection on a separate thread (I am aware that it is asynchronous and works when running on the main thread), but it is not making delegate calls even when I pass the parent thread as the delegate. Does anyone know how to do…
6
votes
0 answers

iOS: HTTP Basic/Digest Auth with a UIWebView

Overview I'm working on a SAML login (single sign-on, similar to openID) solution for an iOS app that involves showing a view controller with a UIWebView and I'm running into a timing and/or timeout issue when handling HTTP basic/digest auth in the…
6
votes
2 answers

NSURLConnectionDownloadDelegate destinationURL

I am currently developing an iPad iOS 6 Application which uses async downloads. To receive progress information i used the delegate NSURLConnectionDownloadDelegate. The download and the progress received by –…
5
votes
1 answer

Queries related to NSURLConnection delegate methods

I am developing an iPhone application that uses NSURLConnection for fetching some network content. My iPhone application should work on iOS >= 4.1 (1) Are the following delegate methods available in all the iOS >= 4.1 including iOS5 (Beta). -…
spd
  • 2,114
  • 1
  • 29
  • 54
5
votes
1 answer

Get the http response code from every UIWebView request

I need to check the response status code while loading any of the url in the webview fo. For now we can consider any of the web application I am loading inside the web view.So I need to track down every request withing that webview and check out the…
1
2 3
11 12