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
3
votes
2 answers
How do do the equivalent of the objective-C mutableCopy in Monotouch?
I have some code in objective-C which uses the 'mutableCopy' method to make a mutable copy of an NSURLRequest object called 'request':
NSMutableURLRequest mutableRequest = [request mutableCopy];
How do I go about doing this in Monotouch?
I tried…

Christopher Disdero
- 87
- 4
3
votes
1 answer
Tunneling web requests on iPhones
I want to know if it is possible to tunnel web requests, and of course what to use/implement.
I have already written subclasses of NSInputStream and NSOutputStream to send & receive data via my custom proxy server, which is working wonderfully for…

Pada
- 646
- 5
- 13
3
votes
2 answers
iPhone SDK: How to check if IP entered by user is valid?
My iPhone application includes several http requests to a server. The server's IP address can be entered by the user so you can use the app in combination with your own private server.
Before making the requests I always check whether or not the IP…

Chris
- 391
- 2
- 6
- 17
3
votes
2 answers
Implementing NSURLRequest, NSURLConnection and NSURLRequestReturnCacheDataElseLoad policy
Do anyone have a sample code for implementing image caching using NSURLRequest, NSURLConnection and NSURLRequestReturnCacheDataElseLoad policy?
I am using the following code but seems like no caching is happening. All the time I am getting the image…

Abhinav
- 37,684
- 43
- 191
- 309
3
votes
1 answer
Alamofire/NSURLSession caching with private Cache-Control and max-age
I'm not sure if I'm doing something wrong, but caching is not working when setting urlRequest.cachePolicy = .useProtocolCachePolicy and having a cache-header set to private with max-age "Cache-Control" = "private, max-age=86400";
Should…

vburojevic
- 1,666
- 5
- 24
- 34
3
votes
1 answer
URlRequest.httpBody is nil inside startLoading() Method of URLProtocol in swift 3.0
I have my custom URLProtocol, which is having some custom response generation. Now i have a requirement, where in i need send some information to server via httpBody (Can be json/String as data) before getting the actual response
My problem is, when…

Padalingam
- 149
- 6
3
votes
1 answer
swift 3 urlRequest session.dataTask not firing
I am trying to get stock quotes from Yahoo using Swift 3. Although there are some decent tutorials on Swift 2, none of them seem to translate well to Swift 3.
The issue I have at the moment is that in the code below, the session.dataTask is never…

Michael Moulsdale
- 1,488
- 13
- 34
3
votes
1 answer
409 is success in Alamofire?
Strange thing happened to me while implementing networking based on Alamofire. So, my backend can return me 409 and when I get it I want to react properly, so I went for a regular solution:
Alamofire.request(someRequest).responseJSON { response in
…

cojoj
- 6,405
- 4
- 30
- 52
3
votes
1 answer
iOS swift post request with binary body
I want to make a POST request from iOS (swift3) which passes a chunk of raw bytes as the body. I had done some experimenting which made me thought the following worked:
let url = URL(string: "https://bla/foo/bar")!
var request = URLRequest(url:…

Travis Griggs
- 21,522
- 19
- 91
- 167
3
votes
2 answers
How to handle "too many HTTP redirects" Error
This issue comes when i load website into webview of my cocoa application.
my issue description:
Error Domain=NSURLErrorDomain Code=-1007 "too many HTTP redirects"
UserInfo=0x18d17d56{NSErrorFailingURLStringKey=URLHERE,
…

S. S
- 169
- 3
- 16
3
votes
3 answers
Cleaning up hanging NSURLConnections when a controller is dealloc'ed
I have a controller that makes HTTP GET requests using a custom class, which acts as the delegate for the NSURLConnection. Once the NSURLConnection fails or finishes, the custom class invokes methods on the controller and passes along an NSData…

pmc255
- 1,499
- 2
- 19
- 31
3
votes
0 answers
Swift protocol witness for URLRequestConvertible
I have a Router Helper function that is used to make all the REST calls within the application. I'm using Alamofire for my REST calls. A recently published app has gotten a couple of crashes that I'm not able to make sense of. During the beta…

Mike Walker
- 2,944
- 8
- 30
- 62
3
votes
3 answers
Proper way to close NSURLConnection
I am using server client architecture in my application.
I am using NSURLConnection class,now suppose i am sending multiple requests in for loop and using async connection with delegate methods.So my question is
after I got response from server do I…

Vaibhav
- 865
- 2
- 10
- 19
3
votes
2 answers
Why my return is nil but if i press the url in chrome/safari, i can get data?
@IBAction func mainButtonnBeTapped(sender: AnyObject) {
let session = NSURLSession.sharedSession()
let request = NSURLRequest(URL: NSURL(string: "http://hq.sinajs.cn/list=sz000609")!)
let task =…

Yiming Chen
- 33
- 4
3
votes
0 answers
iOS POST JSON Echo Disallowed Key Characters
NSMutableDictionary *dictionary=[[NSMutableDictionary alloc] init];
[dictionary setObject:self.uniqueKey forKey:@"unique"];
[dictionary setObject:groupArr forKey:@"addressbook"];
if ([NSJSONSerialization isValidJSONObject:dictionary]){
…

Mukesh
- 3,680
- 1
- 15
- 32