Questions tagged [nsurlconnection]

An NSURLConnection is the Apple Foundation Framework class that provides support to perform the loading of a URL request. It is deprecated and should be replaced by NSURLSession.

An NSURLConnection object provides support to perform the loading of a URL request. The interface for NSURLConnection is sparse, providing only the controls to start and cancel asynchronous loads of a URL request.

It is deprecated in iOS 9.0 and OS X 10.11 and should be replaced by NSURLSession.

NSURLConnection Class Reference

3110 questions
13
votes
2 answers

Stop current NSURLConnection

Currently, I am making an NSURLConnection whenever mySearchBar.text did change. I am experiencing an issue whereby if the user enters text too quickly, The respondData gets corrupted. So, I was wondering is there a way to check whether the same…
Gavin
  • 2,784
  • 6
  • 41
  • 78
13
votes
1 answer

iOS 11, Xcode 9 Error: NSURLConnection finished with error - code -1100

I'm getting this error when working in JS and Ionic 3. I'm testing on my iPhone 7 plus with iOS 11 and Xcode 9. NSURLConnection finished with error - code -1100 Anyone got a similar error in the past?
Dimitri
  • 2,240
  • 3
  • 21
  • 39
13
votes
3 answers

OAuth 2 bearer Authorization header

With an update to the client's API the HTTPBasicAuthication method has been replace with a OAuth2 Bearer Authorization header. With the old API I would do the following: NSURLCredential *credential = [NSURLCredential…
rckoenes
  • 69,092
  • 8
  • 134
  • 166
12
votes
2 answers

NSURLConnection sendSynchronousRequest with ARC

I am beginning to play around with ARC, and one of the first experiements I was trying was to make an HTTP call to a URL and get back some data. Of course, the HTTP status code is important to me, so that means I went to my "goto" of using…
Jason Whitehorn
  • 13,585
  • 9
  • 54
  • 68
12
votes
3 answers

iphone nsurlconnection read cookies

I am using async NSURLConnection to connect to a web site from iPhone. Handle didReceiveResponse is activated on response and I am trying to get all cookies, by using allHeaderFields from NSHTTPURLResponse I see many hreader, but no Set-Cookie - it…
user349302
  • 3,491
  • 7
  • 27
  • 31
12
votes
1 answer

AFNetworking/NSURLConnection HTTPS keep alive shows strange behaviour

We're currently dealing with a performance issues in our app, and we believe that some of these issues might be related to the fact that the app and the underlying AFNetworking network stack seems to ignore keep-alive on HTTP 1.1. We got information…
WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
12
votes
3 answers

Authentication with NSURLConnection sendAsynchronousRequest with completion handler

Generally I like to just "fire and forget" with NSURL's sendAsynchronousRequest class method using the completion handler block but it seems that might not be an option when authentication is needed. When using a completion handler style request…
Nick
  • 8,483
  • 10
  • 46
  • 65
12
votes
3 answers

iOS background Location not sending http request

My app needs to track the users location in the background but it is failing to send a 'get' request. The http request gets sent immediately when the app comes to the foreground. I am using RestKit for all my network requests and I followed this…
Kyle C
  • 4,077
  • 2
  • 31
  • 34
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
7 answers

Using libcurl on iOS 5 as an alternative to NSURLConnection

Update: NSURLConnection now seems to properly support 100-Continue. In any case, this answer contains a link to the script to build libcurl for iOS/OSX. I'm having a bit of a hard time with NSURLConnection, given that it doesn't support Section…
biasedbit
  • 2,860
  • 4
  • 30
  • 47
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
4 answers

Unable to get destinationURL data in connectionDidFinishDownloading for ios5

I'm trying to get a list of assests urls to download. I'm using NSURLConnection in order to get a JSON file that have this list of urls. in - (void)connection:(NSURLConnection *)connection didWriteData:(long long)bytesWritten totalBytesWritten:(long…
mukaissi
  • 2,441
  • 1
  • 21
  • 12
11
votes
4 answers

Request not sent

I'm having a weird problem when i consume my API from my app. Sometimes, for no reason, the request is just not sent, and it fails at the end of the time-out with the following error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed…
streem
  • 9,044
  • 5
  • 30
  • 41
11
votes
1 answer

NSURLConnectionDelegate willSendRequestForAuthenticationChallenge won't get called on iOS 8

My server provide several authentication methods: NTLM and digest. My iOS client won't handle the NTLM authentication, so I implement the connection:willSendRequestForAuthenticationChallenge: delegate to reject the NTLM, then use correct credential…
Davis Cho
  • 340
  • 4
  • 12