nsurlconnection

iOS background Location not sending http request

房东的猫 提交于 2019-12-20 08:47:12
问题 My app needs to track the users location in the background but it is failing to send a 'get' request. The http request gets sent immediately when the app comes to the foreground. I am using RestKit for all my network requests and I followed this tutorial to setup my background locations service. In my applicationDidEnterBackground -(void)applicationDidEnterBackground:(UIApplication *)application { self.bgLocationManager = [[CLLocationManager alloc] init]; self.bgLocationManager.delegate =

NSURLConnection does not call complete across multiple Views

旧巷老猫 提交于 2019-12-20 07:18:02
问题 Earlier today I asked the following question: iOS block being stoped when view pushed The operation I mentioned (OP1) is actually a "http get" to my server, using NSURLConnection. After even more investigation I discovered that the block doesn't actually "die". What really happens is that the request is actually SENT (the server side logs it), even after the view is pushed (verified via [NSThread sleep:10]). The server responds but then NOTHING happens on the app side if the view2 has been

Is that possible to download google derive files without integration with ios

☆樱花仙子☆ 提交于 2019-12-20 07:14:04
问题 Is that possible to download files from google drive without integrate it's sdk (class files) or authentication. Consider following scenario: I Used UIWebView in mysample application. I am logged in to Google Drive through UIWebView (Like logged in to google drive same as browser logged in). Now i want to download google drive documents in to mysample application document folder. Problem: When i am trying to download file from google drive it will now downloaded (I am using nsurl connection

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];

iPhone - Call a php page asynchronously and be sure it has been loaded

和自甴很熟 提交于 2019-12-20 03:52:06
问题 In one of my apps, I'd like to call asynchronously a php page I have written (http://serveradress/page.php?date=20111231), and I would be sure to know if the page could be called (no 404 error, php server down, customised 404 page, missing internet connection, or some things like that). I've planned for that to make the php page return a very simple HTML page with just "OK" in its body or title. This would be a "phantom" call without use of any UIWebView, or if REALLY nedded, a hidden

NSURLConnection closes early on GET

こ雲淡風輕ζ 提交于 2019-12-20 01:11:20
问题 I'm working on a method to centralize my URL connections for sending and receiving JSON data from a server. It works with POST, but not GET. I'm using a Google App Engine server and on my computer it'll handle the POST requests and return proper results (and log appropriately), but I get the following error when I try the request with a GET method: Error Domain=kCFErrorDomainCFNetwork Code=303 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)" UserInfo=0xd57e400

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

Limit NSURLConnection data rate? (Bandwidth throttling)

只愿长相守 提交于 2019-12-19 10:25:06
问题 Is there a way to limit the bandwidth used by an NSURLConnection, or I'm forced to use CFNetwork methods? 回答1: Yes, but it's not pretty (it works according to this mailing list post): Start NSURLConnection on a background thread (you'll have to set up a run loop). Sleep in -connection:didReceiveData: . Forward your data to the main thread in a thread-safe fashion. The third bulletpoint is a little tricky to get right if the delegate is a UIViewController , but something like this should work

Mutable NSHTTPURLResponse or NSURLResponse

别说谁变了你拦得住时间么 提交于 2019-12-19 09:56:48
问题 I need to modify response headers in an NSURLResponse. Is this possible? 回答1: I was just talking about this with a friend. My suggestion would be to write a subclass of NSURLResponse. Something along these lines: @interface MyHTTPURLResponse : NSURLResponse { NSDictionary *myDict; } - (void)setAllHeaderFields:(NSDictionary *)dictionary; @end @implementation MyHTTPURLResponse - (NSDictionary *)allHeaderFields { return myDict ?: [super allHeaderFields]; } - (void)setAllHeaderFields:

NSURLConnectionDelegate connection:didReceiveData not working

限于喜欢 提交于 2019-12-19 07:39:34
问题 I need some help regarding the NSURLConnectionDelegate method. - (void)startDownload { NSString *URLString = [NSString stringWithFormat:appRecord.imageURLString]; NSURL *url = [NSURL URLWithString:URLString]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; imageConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if(imageConnection) { activeDownload = [NSMutableData data]; } } I am using this method to initiate the NSURLConnection, but the - (void