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

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 stackoverflow. I finally came up with the following…
Praneeta
  • 1,554
  • 3
  • 19
  • 20
27
votes
5 answers

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?
27
votes
3 answers

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 like these. Thanks
Forrest
  • 122,703
  • 20
  • 73
  • 107
27
votes
4 answers

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 is, when the table scrolls, the new images are…
Brad
  • 655
  • 2
  • 7
  • 13
25
votes
3 answers

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: NSURLConnection finished with error - code -1002 I paste this…
Genevios
  • 1,115
  • 1
  • 16
  • 29
25
votes
4 answers

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 nonsecure-to-secure seems like a convenient…
Steven Fisher
  • 44,462
  • 20
  • 138
  • 192
24
votes
1 answer

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 I figure out how much data I have already, and…
dontWatchMyProfile
  • 45,440
  • 50
  • 177
  • 260
24
votes
1 answer

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, will those cookies be in storage where they will…
Linuxios
  • 34,849
  • 13
  • 91
  • 116
23
votes
4 answers

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 with "S%C3%A1ndor_Font" as a NSString. Is there any…
user2844801
  • 1,394
  • 2
  • 12
  • 20
22
votes
1 answer

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 using delegates in NSURLSession to implement…
AndrewSB
  • 951
  • 3
  • 11
  • 25
21
votes
5 answers

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…
Desmond
  • 5,001
  • 14
  • 56
  • 115
21
votes
3 answers

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 append the received data to a NSMutableData…
jpm
  • 16,622
  • 34
  • 63
  • 66
21
votes
3 answers

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 allow fragments not set.) UserInfo=0x7b71dbb0…
NITHIN S
  • 231
  • 1
  • 2
  • 6
21
votes
5 answers

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:@"\n%@", data] UTF8String]; NSURL *url = [NSURL…
per_pilot
  • 257
  • 1
  • 2
  • 5
21
votes
4 answers

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 authorization token". This is the code that I am…
harryisaac
  • 1,121
  • 1
  • 10
  • 18