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
598
votes
24 answers

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

I am facing the Problem when I have updated my Xcode to 7.0 or iOS 9.0. Somehow it started giving me the Titled error "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection" Webservice…
Manab Kumar Mal
  • 20,788
  • 5
  • 31
  • 43
207
votes
11 answers

CFNetwork SSLHandshake failed iOS 9

has anyone with the iOS 9 beta 1 had this issue? I use standard NSURLConnection to connect to a webservice and as soon as a call is made to the webservice i get the below error. This is currently working in iOS 8.3 Possible beta bug? any ideas or…
user3099837
  • 3,931
  • 5
  • 15
  • 13
151
votes
16 answers

Easiest way to detect Internet connection on iOS?

I know this question will appear to be a dupe of many others, however, I don't feel the simple case is well explained here. Coming from an Android and BlackBerry background, making requests through HTTPUrlConnection instantly fail if there is no…
RealCasually
  • 3,593
  • 3
  • 27
  • 34
88
votes
13 answers

Managing multiple asynchronous NSURLConnection connections

I have a ton of repeating code in my class that looks like the following: NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; The problem with…
Coocoo4Cocoa
  • 48,756
  • 50
  • 150
  • 175
86
votes
7 answers

Sending an HTTP POST request on iOS

I'm trying to send an HTTP Post with the iOS application that I'm developing but the push never reaches the server although I do get a code 200 as response (from the urlconnection). I never get a response from the server nor does the server detect…
85
votes
8 answers

NSURLConnection and Basic HTTP Authentication in iOS

I need to invoke an initial GET HTTP request with Basic Authentication. This would be the first time the request is sent to the server and I already have the username & password so there's no need for a challenge from the server for…
Alexi Groove
  • 6,646
  • 12
  • 47
  • 54
79
votes
9 answers

How To Check Response.statusCode in sendSynchronousRequest on Swift

How To check response.statusCode in SendSynchronousRequest in Swift The Code is Below : let urlPath: String = "URL_IS_HERE" var url: NSURL = NSURL(string: urlPath) var request: NSURLRequest = NSURLRequest(URL: url) var response:…
hossein1448
  • 975
  • 2
  • 7
  • 10
74
votes
6 answers

how to use sendAsynchronousRequest:queue:completionHandler:

Two part question Part one: I am trying to create an ASynchronous request to my database. I am currently doing it Synchronously however I want to learn both ways to better my understanding of whats going on. Currently I have set up my Synchronous…
C.Johns
  • 10,185
  • 20
  • 102
  • 156
62
votes
2 answers

NSURLConnection timeout?

I'm using this NSURLConnection with delegates. nsconnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; Problem is the website doesn't respond at all. Nothing, just spins in browser with blank page,…
Jordan
  • 21,746
  • 10
  • 51
  • 63
60
votes
3 answers

NSURLConnection Using iOS Swift

I am trying to follow this tutorial and connect to a JSON api using Swift and NSURLConnection. I can see that it is hitting the url but the connectionDidFinishLoading does not seem to fire. import UIKit class Remote: NSObject { var host =…
Ross Nelson
  • 829
  • 1
  • 8
  • 13
57
votes
4 answers

NSURLConnection delegate methods are not called

I am trying to create a simple NSURLConnection to communicate with a server using a GET request. Connection works well, but delegates methods of NSURLConnection are never called.. Here is what am doing: NSString *post = [NSString…
Manish Ahuja
  • 4,509
  • 3
  • 28
  • 35
57
votes
2 answers

Changing the userAgent of NSURLConnection

Hey I am using a NSURL Connection to receive data. [NSURLConnection sendSynchronousRequest: //create request from url [NSURLRequest requestWithURL: //create url from string [NSURL URLWithString:url] ] //request parameters returningResponse:nil…
jantimon
  • 36,840
  • 23
  • 122
  • 185
54
votes
1 answer

NSURLConnection sendAsynchronousRequest:queue:completionHandler: making multiple requests in a row?

I have been using NSURLConnection's sendAsynchronousRequest:queue:completionHandler: method which is great. But, I now need to make multiple requests in a row. How can I do this while still using this great asychronous method?
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
45
votes
5 answers

How to handle "CFNetwork SSLHandshake failed" in iOS

Some times i'm getting CFNetwork SSLHandshake failed -(9806) in my code,but i'm not sure why this is happening as my code runs smoothly,except when i run it in iOS 6 and then on iOS 7 64-bit i get this warning. Can anybody suggest me, how to handle…
Arun_
  • 1,806
  • 2
  • 20
  • 40
39
votes
3 answers

What does NSURLConnection's error code "-1009" mean?

When I send a request and get an error with the error code -1009, what does that mean? I'm not sure how to handle it. - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ NSLog(@"connection didFailWithError"); …
jxx
  • 405
  • 1
  • 4
  • 6
1
2 3
99 100