nsurlrequest

iOS store-and-forward framework for offline HTTP POST requests

时光总嘲笑我的痴心妄想 提交于 2019-12-22 09:55:47
问题 Is there a way (presumably a library?) to store HTTP POST requests when the user is offline, and then transmit the POST requests when the user is back online? (I don't need to read the server's response, except insofar as I'll want to re-queue the requests if the POST request fails.) 回答1: Yes, there is such a library: http://blog.mugunthkumar.com/products/ios-framework-introducing-mknetworkkit/ It is resilient against quits and relaunch of your app, and will keep trying to send your request

NSURLSessionConfiguration HTTPAdditionalHeaders not set

一曲冷凌霜 提交于 2019-12-22 05:52:51
问题 Authorization header is set in NSURLSessionConfiguration , however it is not attached to NSURLSessionDataTask . Is this a bug in Foundation framework ? NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; [configuration setHTTPAdditionalHeaders:@{@"Authorization":@"123"}]; // Initialize session with NSURLSessionConfiguration NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; NSMutableURLRequest *request = [

How to download a web page with it's inner resoures like images,css in iOS?

若如初见. 提交于 2019-12-21 23:47:57
问题 I'm trying to download the specified web pages with their inner page resources to disk. When I send a NSURLRequest, only the initial URL would be request, but the resources as images,css,js would not be download. Someone suggests to use cache, but I don't want to cache every web page browsed in the uiwebview, but only the one I specified.For example, when I input an url to the uiwebview addressbar then click on the "save" button, the page will be saved entire, but the other browsing in the

XTubeManager crash in background?

↘锁芯ラ 提交于 2019-12-21 04:18:26
问题 I am experiencing a large amount of crashes in the XTubeManager (seems to be CFNetwork internal). Unfortunately the console logs are not available, only the call stack (see below). Questions: I could imagine that my app crashes in the background, therefore no console logs are written, do you think this is a possibility? Do I have to handle backgroundTask expiration differently, e.g. by cancelling all my NSURLRequests ? (see code below) Background I am regularly waking up in the background (or

Change User-Agent and remove App Name and defaults iOS

让人想犯罪 __ 提交于 2019-12-21 03:55:13
问题 I am trying to change the User-Agent in iOS, however when I add my custom User-Agent it appends it to the existing User-Agent that contains my app name. This is the code I am using: NSMutableURLRequest *request = [client requestWithMethod:@"POST" path:endpoint parameters:nil]; [request addValue:@"MyUserAgent (iPhone; iOS 7.0.2; gzip)" forHTTPHeaderField:@"User-Agent"]; And the User-Agent appears like this: MyAppName/1.0 (iPhone; iOS 7.0.2; Scale/2.00),MyUserAgent (iPhone; iOS 7.0.2; gzip) I

Unsupported URL in NSURLRequest

[亡魂溺海] 提交于 2019-12-20 09:28:33
问题 If I run this request from my terminal I can see the JSON requests as normally: curl -XGET 192.168.0.6:8888/scripts/data/backend2/index.php/name/_all My code for the NSURlRequest is this: NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@"192.168.0.6:8888/scripts/data/backend2/index.php/name/_all"]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; And I am getting this error: didFailWithError 2013-11-29 22:31:08.164 Ski Greece[607:a0b] Connection

Using NSURLRequest to pass key-value pairs to PHP script with POST

天涯浪子 提交于 2019-12-20 09:01:53
问题 I'm fairly new to objective-c, and am looking to pass a number of key-value pairs to a PHP script using POST. I'm using the following code but the data just doesn't seem to be getting posted through. I tried sending stuff through using NSData as well, but neither seem to be working. NSDictionary* data = [NSDictionary dictionaryWithObjectsAndKeys: @"bob", @"sender", @"aaron", @"rcpt", @"hi there", @"message", nil]; NSURL *url = [NSURL URLWithString:@"http://myserver.com/script.php"];

IOS sending post method data can access in php as get method

可紊 提交于 2019-12-20 06:08:25
问题 I am very new to iOS. I am trying to send data through post method to PHP. In PHP it can't take data like $_POST['data'] , but it takes $_GET['data'] . My iOS code is as follows. NSString *strURL = [NSString stringWithFormat:@"http://example.com/app_respond_to_job?emp_id=%@&job_code=%@&status=Worker-Accepted&comment=%@",SaveID2,txtJobcode1,alertTextField.text]; NSURL *apiURL = [NSURL URLWithString:strURL]; NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:apiURL];

Reverse Engineer HTTP request

ぐ巨炮叔叔 提交于 2019-12-19 21:45:29
问题 I intercepted an HTTP request on Charles originating from iPhone to Instagram and here are the headers POST /logging_client_events HTTP/1.1 Host: graph.instagram.com Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Connection: keep-alive Accept: */* User-Agent: Instagram 10.0.1 (iPhone8,1; iOS 10_1_1; en_IN; en-IN; en; scale=2.00; 750x1334) AppleWebKit/420+ Accept-Language: en-IN;q=1.0, hi-IN;q=0.9, Content-Length: 1601 Accept-Encoding: gzip, deflate There is a Post data as well

NSURLRequest Timeout IOS

会有一股神秘感。 提交于 2019-12-19 19:29:38
问题 I need to set timeout 15sec or 30 sec with UIRequest, but it always takes default one. Is there any way to set minimum timeout to connection. 回答1: This answer explains about the minimum value of timeoutInterval of an NSURLRequest object. If you need a smaller value, then you may do so with starting an NSTimer with the desired time and in the firing method of the timer, you cancel the connection of your NSURLConnection object. As in: //.... connection = [[NSURLConnection connectionWithRequest