nsurlconnection

How to download a large file with the iPhone SDK and avoid memory usage issues?

I'm using the NSURLConnection class to download a large file in my iPhone application, but it crashes every so often because it's using too much memory. I'm doing the usual NSURLConnection usage, to append the received data to a NSMutableData object. - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [s...

Connection to a stream, consuming data, best way to do... iPhone

Hello All, I am writing an iPhone app which connects to a stream and parse bytes from it then create objects. For exemple, first 11 bytes are the header, next 246 bytes are body..., I am thinking about creating class representing them, like FrameHeader, FrameBody, the question I have is what is the best way to consume data without copy...

NSURLConnection, NSURLRequest and remote caching

I'm having a small problem with request caching using NSURLConnection asynchronous connections on the iPhone. I don't know if I understood something incorrectly, or if Cocoa is doing the opposite to what it's supposed to do... The documentation for NSURLRequest says that: NSURLRequestReloadIgnoringLocalCacheData Specifies that ...

What's wrong on following URLConnection?

See also: Objective-C Asynchronous Web Request with Cookies I spent a day writing this code and can anyone tell me what is wrong here? WSHelper is inherited from NSObject, I even tried NSDocument and NSObjectController and everything.. -(void) loadUrl: (NSString*) urlStr{ url = [[NSURL alloc] initWithString:urlStr]; reque...

Creating URL query parameters from NSDictionary objects in ObjectiveC

With all the URL-handling objects lying around in the standard Cocoa libraries (NSURL, NSMutableURL, NSMutableURLRequest, etc), I know I must be overlooking an easy way to programmatically compose a GET request. Currently I'm manually appending "?" followed by name value pairs joined by "&", but all of my name and value pairs need to be...

NSURLConnection delegate doesn't get its didReceiveAuthenticationChallenge method on server status 401

I've setup a simple NSURLConnection to query an http-server. GET /path HTTP/1.1 Host: 192.168.1.161:8282 User-Agent: NetTest1.0 CFNetwork/441.0.2 Darwin/9.6.0 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate Pragma: no-cache Connection: keep-alive The server responds with code 401 and the WWW-Authenticate header set ...

NSURLConnection failure questions

I'm using NSURLConnection as listed below. I have three questions about this class. When I concatenate the url value, the debugger hits this line twice but not the line above it: if (theConnection){ The second time I get EXC_BAD_ACCESS. Using the first url assignment (commented out) works fine. 1.) What's the difference? - (void...

HttpBasicAuthentication in IPhone

Hi All, In my iPhone app, i am trying to display an image on iphone from my server, which needs authorization. I am trying to use NSURLConnection to get the image, but it is not asking me for the user credentials. i.e it is not at all going to didReceiveAuthenticationChallenge method. Can anyone help me with this issue. Thanks, nbojj ...

No Data Returned Using NSURLConnection Asynchronously

Hi everyone, I am having a heck of time with something that seems rather straightforward but I can't seem to get working. I am building an iPhone app that retrieves data from a web host. I am trying to establish an asynchronous connection to the host as I want to keep the device freed up during the connection. (sendSynchronousRequest fr...

how to compare a NSURLconnection http response data with a string value in iphone???

hi......i am new in iphone programming......i want to do an activation module which will send a http request with a PIN numbr and then read the response...if the response is "OK" it opens up with a main menu...........the problem is that i am recieving the response as "OK" but i am unable to compare it with a NSString @"OK"............so...

NSURLConnection do not launch

Hello experts! I'm trying to create a very simple app which connects to an URL and gets the contents of that URL, in this case a simple xml document. My problem is that that the request never seems to gets sent. I have created a new project(Foundation tool) which runs from a main file. I have set the delegate of the NSURLConnection to...

Do I need a protocol for notification?

I have classDownload that uses NSURLConnection. I'd like to keep all of the NSURLConnection events in classDownload. ClassA wants to use classDownload but also receive notifications such as connectionDidFinishLoading, which is called Finish in classDownload. How do I get the notifications from classDownload over to ClassA? ...

NSURLConnection is run many times

I connect asynchronously with server each 5 seconds. The URL is the same, but POST-body is changed each time. Now I create NSURL, NSURLRequest and NSURLConnection from the scratch each time. I think it'd be more effective to set connection once and just use that one further. I am a newbie and not sure if that possible. There is no muta...

iPhone HTTPS

Hi everone, I'm interested in iPhone HTTPS through NSURLConnection, it's possible to send a request, respond to a challenge and load the secure URL. Is there anything else that can be done with NSURLConnection via HTTPS? Thank you in advance! ...

iPhone Login Notifications

Hi Team, Had a question related to best practices in iPhone login authentication using asynchronous NSURLConnection. Since the same delegate is used for logging into a server, how do folks differentiate notifications coming back for an authentication request, versus when you recieve data for subsequent data requests? Thanks, Sj ...

NSURLConnection problem

Hi, I want my application to download some data from the internet, in iPhone SDK documentation i found NSURLConnection class, which is used for downloading, Am i right? I wrote the same code as it is in the documentation and ran it. Connection was created successfully, but no data were downloaded. connectionDidFinishLoading is fired afte...

Download on iPhone Caching?

I felt like I'm having the same issues as addressed here. But everything I try doesn't seem to work. The program goes as follows: I'm asking for user credentials (username/password) Then I do some calls to the server downloading information. When its finished, I display a set of users, the user clicks on one, then is asked for the ...

How to use redirectReponse with NSURLConnection in Cocoa

I'm using some pretty standard URL code in Cocoa - basically result = [NSURLConnection sendSynchronousRequest:query returningResponse:&response error:&serverError]; However I cannot see how to detect when the query (which is the URL) responds with a redirect - ...

Downloading an entire folder from my server to iPhone

Is it possible to download an entire folder of files from my server to the user's iPhone rather than just one file at a time? Also, is the NSURLConnection class the way to go? Also, should I be using an HTTP path or an ftp path? (I've gotten the download of a single file to work with the HTTP, but don't know how to with the ftp or even...

?examine a response while webView:shouldStartLoadWithRequest:naviagiontType... waits?

iPhone/objC I'm really stuck here and I could use some help, please. Let me first explain some things: I have an UIWebView which loads an url. once the user clicks a link - (BOOL)webView:shouldStartLoadWithRequest: navigationType: gets a message (according to the protocol). Inside this method I can decide if the url should be loaded ...