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
16
votes
3 answers

Is there any way to attach a NSDictionary of parameters to an NSURLRequest instead of manually making a string?

AFNetworking allows you to add an NSDictionary of parameters to a request, and it will append them to the request. So if I wanted to do a GET request with ?q=8&home=8888 I'd just making an NSDictionary like @{@"q": @"8", @"home": @"8888"} very…
user2005643
15
votes
4 answers

NSError codes: URL Loading system errors that mean loss of network

I'm trying to write a definitive list of all possible URL error codes that mean loss of network connection, including blips and extended outage. Here's what I have so…
George Burdell
  • 1,349
  • 2
  • 12
  • 20
15
votes
5 answers

NSURLConnection doesn't call delegate methods

I saw similar questions here, but I couldn't find solution to my problem. I have a simple NSURLConnection in main thread (At least I didn't create any other threads), but my delegate methods aren't get called [[[NSURLConnection alloc]…
Burjua
  • 12,506
  • 27
  • 80
  • 111
15
votes
3 answers

Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found

I get this error when I try running the app on a device. I do not get this error when I run it on the simulator and the post request works fine. This is code snippet I have: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url …
shriniwas_ayyer
  • 161
  • 1
  • 1
  • 4
15
votes
2 answers

AFNetworking Enable GZIP

I am looking on the AFNetworking site that GZIP compression is supported " Gzip decompression from server responses is already built into AFNetworking, as NSURLConnection will automatically decompress responses with the Content-Encoding: gzip HTTP…
Alan
  • 9,331
  • 14
  • 52
  • 97
15
votes
2 answers

Xml parsing in iOS tutorial

Hi i'm creating an app which have to print a value in label from an xml file in server.I tried reading some of documentation under google search..but i can't find it...Does any one know simple tutorial or any sample code that is used to integrate…
Vishnu
  • 2,243
  • 2
  • 21
  • 44
14
votes
3 answers

Asynchronous NSURLConnection with NSOperation

I want to do NSURLConnection in background mode,because it response is having much data.Forums are telling to use Apple's finite length coding to use in didEnterBackground. but I want to avoid it.instead of it I use following code through…
nameless
  • 809
  • 3
  • 9
  • 27
14
votes
4 answers

Read NSURLresponse

i am sending an object to this adrees : https://sandbox.itunes.apple.com/verifyReceipt with NSUrlconnection and i am trying to read it with this delegate method : - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse…
orthehelper
  • 4,009
  • 10
  • 40
  • 67
14
votes
2 answers

How do I get the default user-agent string in an NSURLConnection?

I would like to append text to the default user-agent header in an NSURLConnection. I know how to change the user-agent of the NSURLConnection, but I don't see how to get the default user-agent. I tried the following: NSMutableURLRequest *request =…
Brandon DuRette
  • 4,810
  • 5
  • 25
  • 31
14
votes
3 answers

Determining Trust With NSURLConnection and NSURLProtectionSpace

I would like to ask a followup question to a previously posed question. I've got the code to create an NSURLRequest/Connection, run it and have the callback methods for authentication get called. Here's the specific code: -…
Staros
  • 3,232
  • 6
  • 30
  • 41
14
votes
3 answers

Do I need to replace NSURLConnection in order to achieve mandatory support for IPv6-only services?

As Apple is requesting app submitted for review must support IPv6-only network starting from 1st June 2016, I am checking if I need to replace certain API / libraries in my app. However I don't know much enough about networking and some related…
peakingcube
  • 1,388
  • 15
  • 32
14
votes
3 answers

ApplicationWillTerminate NSURLSession Possible?

I am attempting to do a quick POST via NSURLSession at application termination. Application termination is defined as the user swipes it out when on the home screen. Furthermore, applicationWillTerminate is demonstratively called (so that's not in…
user330739
  • 455
  • 1
  • 6
  • 15
14
votes
2 answers

AFNetworking/NSURLConnection receiving NSPOSIXErrorDomain Code=9 "The operation couldn’t be completed. Bad file descriptor"

In my app which uses AFNetworking/NSURLConnection for sending requests to the server I sometimes (very rarely) see this error in operation failure block: Error Domain=NSPOSIXErrorDomain Code=9 "The operation couldn’t be completed. Bad file…
kolyuchiy
  • 5,465
  • 2
  • 23
  • 31
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
14
votes
2 answers

iOS: Data Sessions vs Ephemeral Sessions

My app's webView loads a page and I inject some javascript which automates a click for me and adds an item to my wish list. For something like this would you recommend using a data session or an ephemeral session to load the page? Speed is important…
KingPolygon
  • 4,753
  • 7
  • 43
  • 72