Questions tagged [nsurlrequest]

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.

1095 questions
4
votes
0 answers

NSURLCache not working after iOS app termination

I am building an app in which I am implementing offline mode as well. For this I used NSURLCache mechanism. When the app is in foreground then the cache mechanism works perfectly even if the device goes in offline mode. The problem comes when I quit…
4
votes
1 answer

NSURLCache's removeCachedResponseForRequest has no effect

I've created an NSURLCache subclass which forces caching of responses for a designated amount of time. This is working well, and cached items are expired as expected. However I'm running into issues when trying to forcefully remove a cached response…
ndg
  • 2,585
  • 2
  • 33
  • 58
4
votes
1 answer

NSURL from NSURLConnection?

It seems dead simple, as to create an NSURLConnection I usually do this: NSURL *theURL = [NSURL URLWithString:urlString]; NSURLRequest *req = [NSURLRequest requestWithURL:theURL]; NSURLConnection *connection = [NSURLConnection…
jbrennan
  • 11,943
  • 14
  • 73
  • 115
4
votes
0 answers

Getting the IP address or CFStream from a NSURLConnection / NSURLRequest

I'm trying to get the underlying socket/stream or the IP address from a NSURLConnection as the request starts transmitting a response. I haven't been able to find a way to get the underlying lower level stream from an active request (which would…
Michael Petrov
  • 2,247
  • 15
  • 15
4
votes
1 answer

NSCFString absoluteURL exception

This is my code to retrieve data from a MySQL table using JSON: //URL definition where php file is hosted int categoriaID = [[categoriaDescription objectForKey:@"idCategoria"] intValue]; NSString *string = [NSString stringWithFormat:@"%d",…
mvasco
  • 4,965
  • 7
  • 59
  • 120
4
votes
1 answer

NSURLSession delegate methods not called

I have created a very simple app to download a text file from my web server. I have this working perfectly with NSURLConnection, but am trying to migrate over to NSURLSession instead. The issue I am having is that none of the delegate methods are…
Scooter
  • 4,068
  • 4
  • 32
  • 47
4
votes
1 answer

unable to fetch data as Post when Sending it as Post From IOS NSMutableURLRequest

this is the snippet to my Code, i am sending the code to a PHP page, but when i do print_r($_POST); i get empty Array, but when i do print_r($_GET) i get the variable which i am using to post the data i.e name but it also is empty, can any 1 sort…
iOS Hero
  • 135
  • 10
4
votes
1 answer

Why, after setting an NSHTTPCookie, is it not appended to the NSURLRequest?

I am setting (or attempting to set) an NSHTTPCookie as follows: + (void)setCookie { NSString* cookieName = @"MyCookieName"; NSString* cookieValue = @"MyCookieValue"; NSString* cookieOriginURL = @"www.mycompany.com"; NSString* cookiePath =…
Hap
  • 556
  • 1
  • 6
  • 20
4
votes
1 answer

IOS - Token Authentication in HTTP headers with NSURLRequest

I am having some trouble using HTTP token authentication with a NSMutableURLRequest. I have done some research and have used the following question: ios managing authentication tokens from NSURLRequest / HTTP request to learn how to set the token…
ScottOBot
  • 839
  • 3
  • 16
  • 37
4
votes
3 answers

NSURLSession delegation: How to implement my custom SessionDelegate class accordingly?

Got a singleton class, so called RequestManager, which shall handle requests made by different modules and background tasks of my application. @interface RequestFactory : NSObject - (void)requestDataWith:(NSString *)token …
Kuno
  • 75
  • 1
  • 11
4
votes
3 answers

NSURLRequest cache issue iOS 7

in iOS 7 cachePolicy doesn't work, it just cache the downloaded json. //URLRequest NSString *url = [NSString stringWithFormat:@"http://www.semhora.com/jsonparser/categories/categories_%d_test.json", _categoriesIndex]; NSURLRequest…
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97
4
votes
0 answers

Maximum upload size on iOS / NSURLRequest / NSURLConnection

I'm uploading multi-gigabyte files from iPhones/iPods, and I noticed that NSURLConnection and friends incorrectly use signed 32-bit integers for the number of bytes in the upload (all of Apple's other API's use (long long) a.k.a. (int64_t) -…
Adam
  • 32,900
  • 16
  • 126
  • 153
4
votes
3 answers

How to send big big string through NSURLConnection

This is my code. - (void)loadData:(NSString *)url { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; } - (void)connection:(NSURLConnection…
Suraj Gupta
  • 200
  • 9
4
votes
1 answer

How to use a proxy server in objective-c when send a NSMutableURLRequest?

I want to use the proxy server as below to send a request.But I don't know the way to use a proxy server in objective-c? proxy server: 72.64.146.136: 3128 Can anyone tell me?Thank you sincerely!
stream
  • 369
  • 1
  • 7
  • 18
4
votes
1 answer

NSURLResponse returns Content-Range, ignoring the Range that I asked for

When downloading a file, I want to be able to resume the download. For example: NSFileManager *fm = [NSFileManager defaultManager]; NSString *downloadTempPath = [_tempPath path]; if ([fm fileExistsAtPath:downloadTempPath]) { // We have a…
Skotch
  • 3,072
  • 2
  • 23
  • 43