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.

nsurlconnection
Filter by
Sorted by
Tagged with
612 votes
27 answers
383k views

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 ...
Manab Kumar Mal's user avatar
207 votes
11 answers
121k views

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 ...
user3099837's user avatar
  • 3,931
151 votes
16 answers
144k views

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 ...
RealCasually's user avatar
  • 3,603
88 votes
13 answers
44k views

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 ...
Coocoo4Cocoa's user avatar
  • 49.5k
86 votes
7 answers
175k views

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 ...
Daan Luttik's user avatar
  • 2,815
85 votes
8 answers
90k views

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 ...
Alexi Groove's user avatar
  • 6,676
82 votes
10 answers
98k views

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 = ...
hossein1448's user avatar
  • 1,005
74 votes
6 answers
85k views

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 ...
C.Johns's user avatar
  • 10.2k
62 votes
2 answers
73k views

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. ...
Jordan's user avatar
  • 21.8k
60 votes
3 answers
107k views

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 ...
Ross Nelson's user avatar
57 votes
4 answers
30k views

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 ...
Manish Ahuja's user avatar
  • 4,519
57 votes
2 answers
42k views

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:...
jantimon's user avatar
  • 37.4k
54 votes
1 answer
54k views

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 ...
Nic Hubbard's user avatar
  • 41.9k
45 votes
4 answers
60k views

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 ...
Arun_'s user avatar
  • 1,816
39 votes
3 answers
53k views

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 *)...
jxx's user avatar
  • 405
37 votes
2 answers
25k views

NSURLConnection/NSURLRequest gzip support

Does anyone knows if NSURLConnection/NSURLRequest have support for gzip requests. If does, can you provide more information?
mxg's user avatar
  • 21.1k
37 votes
3 answers
19k views

Asynchronous request to the server from background thread

I've got the problem when I tried to do asynchronous requests to server from background thread. I've never got results of those requests. Simple example which shows the problem: @protocol ...
Dmytro's user avatar
  • 2,532
36 votes
8 answers
51k views

SSL Error in Connection to Server through iPhone

I am trying to establish a HTTPS connection to a server using my app. But the connection fails due to following error Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a ...
devsri's user avatar
  • 6,183
36 votes
3 answers
38k views

How to use iOS Reachability

I'm developing an iPhone app that uses the network. The iPhone communicate with my server via HTTP request and should work on WiFi and 3G. I currently use NSURLConnection initWithRequest to send async ...
Eyal's user avatar
  • 10.8k
35 votes
3 answers
17k views

NSURLConnection and grand central dispatch

Is it advisable to wrap up NSUrlConnection in a gcd style blocks and run it on a low_priority queue? I need to ensure that my connections are not happening on the main thread and the connections need ...
Jonas Anderson's user avatar
33 votes
5 answers
17k views

iOS: How can i receive HTTP 401 instead of -1012 NSURLErrorUserCancelledAuthentication

I have a problem similar to the one described in the link below. NSHTTPURLResponse statusCode is returning zero when it should be 401 I use [NSURLConnection sendSynchronousRequest:returningResponse:...
Tomen's user avatar
  • 4,854
33 votes
2 answers
32k views

NSURLSession + server with self signed cert

I have an app that is production along with a development server that has a self signed certificate. I am attempting to test NSURLSession and background downloading but can't seem to get past - (...
random's user avatar
  • 8,598
32 votes
2 answers
21k views

Reading data from response header of NSURLConnection

How can I read the data from the header sent by in the server response. I am using NSURLConnection to send the request.
Abhinav's user avatar
  • 38k
32 votes
5 answers
42k views

NSMutableURLRequest timeout interval not taken into consideration for POST requests

I have the following problem. On a NSMutableURLRequest using the HTTP method POST the timeout interval set for the connection is ignored. If the internet connection has a problem (wrong proxy, bad dns)...
user177844's user avatar
32 votes
1 answer
47k views

How can I get NSURLResponse body?

I'm writing an application that connect with a server using NSURLConnection. In the delegate method didreceiveresponse, if the status code is 404, I cancel the connection and I would like to show a ...
telemaco's user avatar
  • 321
31 votes
3 answers
24k views

NSMutableURLRequest not obeying my timeoutInterval

I'm POST'ing a small image, so i'd like the timeout interval to be short. If the image doesn't send in a few seconds, it's probably never going to send. For some unknown reason my NSURLConnection is ...
kubi's user avatar
  • 48.8k
29 votes
4 answers
15k views

NSURLConnection methods no more available in IOS5

I was looking at the NSURLConnection class which could be used to establish a sync or async connection to an URL and then retrieve its data... a lot of changes have been made to this class with IOS 5 ...
Gianni Costanzi's user avatar
29 votes
3 answers
8k views

NSURLConnection vs. NSData + GCD

NSData has always had a very convenient method called +dataWithContentsOfURL:options:error:. While convenient, it also blocks execution of the current thread, which meant it was basically useless for ...
Matt Wilding's user avatar
  • 20.1k
28 votes
5 answers
20k views

Clear NSURLConnection cache

Is there a way to clear NSURLConnection cache? I used that to download some strings but I keep getting the same strings even though I changed that from my server.
moeseth's user avatar
  • 1,905
28 votes
1 answer
31k views

Retrieve HTTPResponse/HTTPRequest status codes in iOS?

I need to check and evaluate the HTTP Status Codes in my iPhone app. I've got an NSURLRequest object and an NSURLConnection that successfully (I think) connect to the site: // create the request ...
cmcculloh's user avatar
  • 48.1k
28 votes
5 answers
15k views

what is the advantage of using Alamofire over NSURLSession/NSURLConnection for networking?

Can anyone help me in understanding these question : What is the advantage of using Alamofire over NSURLSession/ NSURLConnection? What are the differences between NSURLSession and NSURLConnection?
Srikanth Adavalli's user avatar
27 votes
3 answers
38k views

What is the biggest difference between NSURLConnection and NSURLSession

NSURLSession is new network SDK than NSURLConnection from Apple. 3rd old choice is CFNetwork. Question here is to figure out the biggest difference between them to understand why Apple is evolving ...
Forrest's user avatar
  • 125k
27 votes
4 answers
13k views

Delayed UIImageView Rendering in UITableView

Ok, I've got a UITableView with custom UITableViewCells that each contain a UIImageView whose images are being downloaded asynchronously via an NSURLConnection. All pretty standard stuff... The issue ...
Brad's user avatar
  • 685
27 votes
4 answers
72k views

Post data in Objective C using Json

I am trying to post data to a PHP web service. I am familiar doing this in html using query $.post but I am very much stumped trying this in objective C. I tried several blogs & questions found on ...
Praneeta's user avatar
  • 1,564
25 votes
4 answers
32k views

Handling redirects correctly with NSURLConnection

For the purposes of this, I'm going to pretend the original url is http://host/form and the new url is https://host/form. (Note that before I ship this, both URLs are going to be secure. However, the ...
Steven Fisher's user avatar
25 votes
3 answers
63k views

NSURLConnection finished with error - code -1002

Friends i have simple audio player (MPMoviePlayerController) which can play audio stream. On iOS 11 i have very interessing trouble, thousand time i have error and my stream was stopped: ...
Genevios's user avatar
  • 1,145
24 votes
4 answers
40k views

How do I remove/decode URL percent encoding?

I want to take a url and convert it to a more readable format. For example I have the following link: http://en.wikipedia.org/wiki/S%C3%A1ndor_Font I take away the unnecessary parts and am left ...
user2844801's user avatar
  • 1,404
24 votes
1 answer
24k views

How to make an progress bar for an NSURLConnection when downloading a file?

I want to show up an progress bar while a download with NSURLConnection is happening. As I am getting data from the server, I could update the UI for every received package. But the problem is: How do ...
dontWatchMyProfile's user avatar
24 votes
1 answer
12k views

Do UIWebView and NSURLConnection share cookie storage?

I'm building an iOS app that uses Google App Engine for the backend. Google provides an HTML login site that stores an authentication cookie. If I visit that site in a UIWebView, and the user logs in, ...
Linuxios's user avatar
  • 35.3k
22 votes
4 answers
10k views

NSURLConnection Authorization Header not Working

I am trying to send an OAuth access token in an HTTP header via NSURLConnection but it doesn't seem to be sending the header because the API keeps giving me an error saying that "must provide ...
harryisaac's user avatar
  • 1,141
22 votes
1 answer
31k views

NSURLSession delegate vs. completionHandler

I've always used completion handlers. With NSURLConnection and now with NSURLSession. It's led to my code being really untidy, especially I have request within request within request. I wanted to try ...
AndrewSB's user avatar
  • 951
21 votes
4 answers
24k views

Check if NSURL returns 404

I need to check whether a URL (represented by a NSURL) is available or returns 404. What is the best way to achieve that? I would prefer a way to check this without a delegate, if possible. I need to ...
Erik's user avatar
  • 12k
21 votes
3 answers
21k views

How to download a large file with the iPhone SDK and avoid memory usage issues?

I'm using the NSURLConnection class to download a large file in my iPhone application, but it crashes every so often because it's using too much memory. I'm doing the usual NSURLConnection usage, to ...
jpm's user avatar
  • 16.7k
21 votes
5 answers
54k views

How to send Asynchronous URL Request?

I would like to know how do I get a return value 1 or 0 only.... back from an URL request asynchronously. currently I do it in this way: NSString *UTCString = [NSString stringWithFormat:@"http://web....
Desmond's user avatar
  • 5,001
21 votes
5 answers
61k views

iPhone sending POST with NSURLConnection

I'm having some problems with sending POST data to a PHP script with NSURLConnection. This is my code: const char *bytes = [[NSString stringWithFormat:@"<?xml version=\"1.0\"?>\n<mydata&...
per_pilot's user avatar
  • 257
21 votes
3 answers
46k views

NSURLConnection : JSON text did not start with array or object and option to allow fragments not set

I get the following error from NSURLConnection connectionDidFinishLoading "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to ...
NITHIN S's user avatar
  • 231
20 votes
6 answers
34k views

Ignoring certificate errors with NSURLConnection

I am getting this error The certificate for this server is invalid. You might be connecting to a server that is pretending to be "server addres goes here" which could put your confidential ...
Ideveloper's user avatar
  • 1,477
19 votes
2 answers
54k views

error handling with NSURLConnection sendSynchronousRequest

how can i do better error handling with NSURLConnection sendSynchronousRequest? is there any way i can implement - (void)connection:(NSURLConnection *)aConn didFailWithError:(NSError *)error i have ...
Nnp's user avatar
  • 1,853
19 votes
2 answers
9k views

When is a NSURLResponse not a NSHTTPURLResponse?

I've seen a lot of code, including Apple's SimpleURLConnections sample, that simply cast any NSURLResponse to a NSHTTPURLResponse. If it is always a NSHTTPURLResponse why do the NSURLConnections not ...
CornPuff's user avatar
  • 1,924
19 votes
1 answer
30k views

NSURLConnection deprecated in iOS9

I want to download a file with a NSURLRequest and save it but in the line with the NSData * data = ... happens an error. NSURL *Urlstring = [NSURL URLWithString:@"http://yourdomain.com/yourfile.pdf"...
Maximilian's user avatar

1
2 3 4 5
63