on iOS , NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme. NSURLRequest encapsulates two basic data elements of a load request: the URL to load, and the policy to use when consulting the URL content cache made available by the implementation.
Questions tagged [nsurlrequest]
1095 questions
14
votes
2 answers
Constantly growing memory allocation while fetching images over HTTP in iOS
I am implementing an iOS App that needs to fetch a huge amount of images over HTTP. I've tried several approaches but independently what I do, Instuments shows constantly increasing memory allocations and the App crashes sooner or later when I run…

sink12
- 141
- 1
- 4
13
votes
3 answers
When did caching in a UIWebView start working?
I've been testing an iPhone view controller that uses a UIWebView to load external content, as opposed to resources in the project's bundle. Another engineer noticed that the web view wasn't caching at all, so I went into do some research. Some…

goldierox
- 1,085
- 1
- 8
- 23
13
votes
3 answers
Can you intercept NSURLRequests in a UIWebView without breaking the back button?
I'm having trouble loading custom HTML into my UIWebView without breaking its goBack method.
What Works
I'm intercepting the URL requests of my UIWebView so I can load custom HTML. I have control over all the HTML, so I have my special app requests…

zekel
- 9,227
- 10
- 65
- 96
13
votes
2 answers
NSURLRequest won't fire while UIScrollView is scrolling
I have a problem in that I am trying to background load a sound file while the user moves around a UIScrollView... The problem is that I am using NSURLRequest so I can load in the background, but even then it refuses to actually load until the…

jowie
- 8,028
- 8
- 55
- 94
13
votes
1 answer
Getting data out of completionHandler in Swift in NSURLConnection
I am trying to write a function that will execute an asynchronous GET request, and return the response (as any data type, but here it is as NSData).
This question is based on: How to use NSURLConnection completionHandler with swift
func…

cosmikwolf
- 399
- 7
- 15
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
No Internet Connection Handling on UIWebView and NSURLRequest
I have an app which is entirely web-based and needs an internet connection to navigate around. Basically a website viewed through a UIWebView.
I need to be able to tell the user that no pages can load if they have no internet connection. Is there a…

Dan Hanly
- 7,829
- 13
- 73
- 134
12
votes
3 answers
NSURLRequest cannot handle HTTP body when method is not POST?
Whenever I set a body on a mutable request with the method set to anything other than POST, the body is not included in the request and I get a kCFErrorDomainCFNetwork error 303 (kCFErrorHTTPParseFailure) when the server replies. Changing the method…

Mark
- 121
- 1
- 1
- 3
12
votes
3 answers
NSURL found nil while unwraping an Optional value
Anyone knows why am I getting
fatal error: unexpectedly found nil while unwrapping an Optional value
When i use
let URL = NSURL(string: "https://roads.googleapis.com/v1/snapToRoads?path=-35.27801,149.12958|-35.28032,149.12907")!

Guilherme Miranda
- 1,052
- 2
- 10
- 19
12
votes
2 answers
How to retry a block based URL Request
I am fetching data using iOS7's new URL request methods, like so:
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:[NSURL URLWithString:[self.baseUrl
stringByAppendingString:path]]];
NSURLSessionDataTask *dataTask =…

AlexR
- 5,514
- 9
- 75
- 130
11
votes
5 answers
Swift 2.0, Alamofire: Set cookies in HTTP Post Request
I want to set cookies in my HTTP POST request.
Something like the cookie field in the HTTP Request below,
version: 0.1.7
Cookie: client=Android; version=0.1.7; sellerId=SEL5483318784; key=178a0506-0639-4659-9495-67e5dffa42de
Content-Type:…

dashbashrumble
- 251
- 1
- 5
- 19
11
votes
3 answers
How do I make HTTP post request for getting JSON object in response for iPhone application?
I've a web service running on server which return data either in XML format or JSON format.
I wanted to request a JSON format but using HTTP Post method.

Amit Vaghela
- 2,970
- 7
- 33
- 43
11
votes
2 answers
How to make POST NSURLRequest with 2 parameters?
I want to add 2 parameters to NSURLRequest.
Is there a way or should I use AFnetworking?

l.vasilev
- 926
- 2
- 10
- 23
11
votes
2 answers
Resume download functionality in NSURLConnection
I am downloading some very large data from a server with the NSURLConnection class.
How can I implement a pause facility so that I can resume downloading?

Biranchi
- 16,120
- 23
- 124
- 161
11
votes
3 answers
Does NSURLConnection take advantage of NSURLCache?
I'm trying to figure out how to use the URL loading framework to load URLs taking advantage of caching.
I am using NSURLConnections and feeding them NSURLRequests. I have even set the cachePolicy on those requests to…

jasoncrawford
- 2,713
- 2
- 21
- 20