nsurlconnection

How to send HTTP POST request to PHP service with Objective-C

試著忘記壹切 提交于 2019-12-11 14:27:05
问题 Im trying to post to php and get the response. The php file has an echo "hello" which should just print hello. I'm trying to test to see if posting is working but in my error log the NSlog doesn't display anything: @interface ViewController () @end @implementation ViewController @synthesize email, password,receivedData; -(IBAction)Login:(id)sender{ // Create the request. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://grouporder.site90.net/test

how to send NTLM request in iOS

天大地大妈咪最大 提交于 2019-12-11 13:39:30
问题 I was using json(NSJSONSerialization) and NSURL for server client communication. Till now it was working fine but now NTLM security has been implemented on server. Can anyone tell me how to send request with NTLM in iOS ? Thanks 回答1: If you can use NSURLProtectionSpace, it provides NSString *NSURLAuthenticationMethodNTLM; authentication method. Something on the lines: NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost: _host port: 80 protocol: @"http" realm:

How can I receive my data in pieces with using NSURLConnection's sendAsynchronousRequest method?

余生颓废 提交于 2019-12-11 12:21:42
问题 When I send a synchronous request with NSURLConncetion [NSURLConnection initWithRequest:myRequest delegate:self]; I can receive my downloaded data in pieces with the following method - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [self.videoData appendData:data]; NSLog(@"APPENDING DATA %@",data); } The advantage of this is that I can write my data directly to a file, and limit ram usage when downloading large files. When I send an asynchronous request, how

How to manage multiple asynchronous NSURLConnection request

白昼怎懂夜的黑 提交于 2019-12-11 11:05:10
问题 I am making 3 NSURLConnection requests on app start and exit in appdelegate.m, I am using asynchronous call, the response returned is array of dictionaries, with array having same name in all responses, so I cannot check with key. So I tried declaring NSURLConnection variables in appdelgate.h and then in connectionDidFinishloading compared each declared connection object with connection paramter //Appdelegate.h NSURLConnection *conn1; NSURLConnection *conn2; NSURLConnection *conn3; then in /

How to make a queue of NSURLRequest using GCD?

浪尽此生 提交于 2019-12-11 10:39:58
问题 I have a NSMutableArray containing 7 internet URLs from which I need to grab the HTTP headers. I'm using these methods to make asynchronous connections (and all works perfectly): - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error - (void)connectionDidFinishLoading:(NSURLConnection *

How to Importing image from server and arrange it in a view

别说谁变了你拦得住时间么 提交于 2019-12-11 10:38:54
问题 I need to get array of images that have to call from server and arrange that in an order.But while executing below code i can't get it...Guidance please... - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view { NSURL *url = [NSArray arrayWithObjects:[NSURL URLWithString: @"http://images.wikia.com/marvelmovies/images/5/5e/The-hulk-2003.jpg"], [NSURL URLWithString:@"http://cdn.gottabemobile.com/wp-content/uploads/2012/06/ios62.jpg"], [NSURL

UITableView delegates not getting called after NSURL delegates

妖精的绣舞 提交于 2019-12-11 10:18:58
问题 I am trying to create an iOS app that gets some data from a web service and displays it in customized cells. So far i could verify via NSLog cmd that the data actually is in the corresponding array. This means the Connection delegates getting called. But unfortunately not the TableView delegates. Or lets say they are getting called but maybe at the wrong place? i also tried to reload the Table view after the connectionDidFinishLoading method but it does not work too. Any idea what is wrong?

Swift: 'ViewController.Type' does not have a member named 'URL'

流过昼夜 提交于 2019-12-11 09:38:46
问题 I have some code in my viewController var URL: NSURL = NSURL(string: "http://someurl.com")! var request : NSMutableURLRequest = NSMutableURLRequest(URL:URL) request.HTTPMethod = "POST" var bodyData = "data=something" NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response, data, error) in println(NSString(data: data, encoding: NSUTF8StringEncoding)) } However I get the error: 'ViewController.Type' does not have a member named 'URL'. If I put the code

NSURLConnection sendSynchronousRequest - is it possible to implement without leak

二次信任 提交于 2019-12-11 09:19:00
问题 Is there a way to implement NSURLConnection without it leaking? A number of Apps including NYTimes and others (including mine) suffer from this. Anyone have a working implementation? 回答1: It appears that best practice is to use NSURLConnection asynchronously. 回答2: According to the documentation, +[NSURLConnection sendSynchronousRequest:returningResponse:error:] is built on top of the asynchronous loading code made available by NSURLConnection . It would not be difficult to reimplement this by

iOS any way to cancel all network requests

旧城冷巷雨未停 提交于 2019-12-11 08:34:53
问题 I'm doing the app update module. What I want to do is: if there is a newer version detect, prompt user update AND at the same time, cancel all network requests if there is. The request may created by AFNETWORK, may created like [NSURLConnection sendSynchronousRequest:returningResponse:error:], all kind of network request, just cancel them all. Can I? 回答1: Connections created using + (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error: