nsurlconnection

Network connection was lost NSURLConnection

这一生的挚爱 提交于 2019-12-11 20:54:16
问题 This error is printed every time I attempt a connection. No idea why it cant connect to the server. Built a simple java application and it worked fine. Ive been surfing StackOverflow for days trying to figure this out. Tried multiple API's and somethings just not right. If you need more code, or have any further questions let me know. Please help. :( 2013-08-29 21:56:55.946 panic[15054:70b] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0xa779a30

NSURLConnectionDataDelegate order of functions

陌路散爱 提交于 2019-12-11 20:51:42
问题 In the NSURLConnectionDataDelegate there are a couple of functions that are pretty essential to making sure everything worked but I'm never sure what happens when. The functions... - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response; - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data; - (void)connectionDidFinishLoading:(NSURLConnection *)connection; and a couple of others. Do they always happen in the order I've put them? i

2nd use of NSURLConnection causes SIGABRT iPhone

佐手、 提交于 2019-12-11 19:45:35
问题 I have hunted around a lot on posts to do with NSURLConnection and more generally SIGABRT debugging but have had no joy on this. Any help is greatly appreciated. So, at the start of my app the user is presented with a login view and on supplying user name and password I start an NSURLConnection by doing the following in a LoginService class: -(void)loginWithURLRequest:(NSString*)requestString { if(self.mConnection == nil) { NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL

How to use the NSUrlConnection for getting the data from web?

独自空忆成欢 提交于 2019-12-11 18:17:21
问题 In my application I want to use the NSURLConnection class. So please tell me how to use this one? This contain the lot of delegate methods, please tell me how to use them? 回答1: Initiate the connection using self.responseData = [NSMutableData data]; NSURL *url = [NSURL URLWithString:@"http://sampleurl/"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [connection autorelease]; and you can

download files using http request in background in iPhone (above iOS 4.0)

无人久伴 提交于 2019-12-11 17:58:31
问题 I am new to iOS. I want to know some basic need for my application is possible or not? "When my application starts (tapping on my application icon), app should download some 5-10 files from server. It should continue its downloading in background also if "Home" button is pressed. And my app has retry logic i.e. if server is unreachable and request timeout occurred then app will wait for some time and send request again and again till downloading completed." Is it possible? 回答1: So what you

Using sendAsynchronousRequest:queue:completionHandler: for URL request

送分小仙女□ 提交于 2019-12-11 17:08:14
问题 I'm working on an update of an iOS app that another developer created. He was using ASIHTTPRequest to handle http requests. However, the version of the app I have to work with crashes. Since ASIHTTPRequest is not being updated anymore, I thought then that I should switch to using AFNetworking, but it's far too complicated for me to figure out. So finally I thought I could just use NSURLConnection on its own. Here is the original code that I'm trying to replace: -(NSArray*)readUTF16LEFeed:

Serializing NSURLConnection Requests (iOS) - Use Synchronous Request?

╄→尐↘猪︶ㄣ 提交于 2019-12-11 15:38:03
问题 I'm looping through a list of dates and making a request to a web server for each date in the list. I would like each date to be processed completely before the subsequent request is sent to the server. To do this, I have set up a serial dispatch queue using GCD. Each time through the date loop, a block is added to the queue. The problem I am having is that my NSURLConnection is set up using the standard asynchronous call. This results in requests not blocking any subsequent requests. They

Thread Vs Async call

半世苍凉 提交于 2019-12-11 15:25:30
问题 I wanted to know the best between Spawning a Thread or making a async call using NSURLConnection class. 回答1: See the documentation. An NSURLConnection object provides support to perform the loading of a URL request. The interface for NSURLConnection is sparse, providing only the controls to start and cancel asynchronous loads of a URL request. i.e. NSURLConnection only supports asynchronous loading of content. Even the sendSynchronousRequest:returningResponse:error: method is really just a

How to return the ouput if method is using NSURLConnection Asynchronous calls with blocks

本小妞迷上赌 提交于 2019-12-11 14:50:12
问题 I am sending request to server to get response using NSURLConnection blocks method. I am not able to use return YES or return NO in the block. How can i fix this? -(BOOL)checkForValidUrl:(NSString *)url { __block int httpStatus=0; NSMutableURLRequest *request=[[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:url]]; [request setValue:@"application/json" forHTTPHeaderField:@"content-type"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [NSURLConnection

Get remote file size via HTTP without downloading said file

眉间皱痕 提交于 2019-12-11 14:45:07
问题 Any way to get the size of a (remote, http) file without actually downloading it? All other similar questions seem to revolve around grabbing the expectedContentLength from the NSURLResponse object in didReceiveResponse: but I don't want to download the file, I just want to know how big it is. 回答1: Try to make HEAD request, it returns only headers with Content-Length header included. ~$ curl -I http://google.com/ HTTP/1.1 301 Moved Permanently Location: http://www.google.com/ Content-Length: