nsurlconnection

How to identify WHICH NSURLConnection did finish loading when there are multiple ones?

Multiple NSURLConnections being started (in a single UIViewController) to gather different kinds of data. When they return (-connectionDidFinishLoading) I wanna do stuff with the data, depending on the type of data that has arrived. But one prob, HOW DO I KNOW WHICH NSURLConnection returned? I need to know so I can take action specific t...

Memory management for NSURLConnection

Sorry if this has been asked before, but I'm wondering what the best memory management practice is for NSURLConnection. Apple's sample code uses -[NSURLConnection initWithRequest:delegate:] in one method and then releases in connection:didFailWithError: or connectionDidFinishLoading:, but this spits out a bunch of analyzer warnings and ...

How to use NSURLDownload

- (IBAction)startDownloadingURL:(id)sender { // create the request NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com/index.html"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // create the connection with the request // and start loading the data ...

How to get correct Set-Cookie headers for NSHTTPURLResponse?

I want to use the following code to login to a website which returns its cookie information in the following manner: Set-Cookie: 19231234 Set-Cookie: u2am1342340 Set-Cookie: owwjera I'm using the following code to log in to the site, but the print statement at the end doesn't output anything about "set-cookie". On Snow leopard, the li...

NSURL from NSURLConnection?

It seems dead simple, as to create an NSURLConnection I usually do this: NSURL *theURL = [NSURL URLWithString:urlString]; NSURLRequest *req = [NSURLRequest requestWithURL:theURL]; NSURLConnection *connection = [NSURLConnection connectionWithRequest:req delegate:self]; But how can I get the URL back in the delegate methods? Short of ha...

Update iPhone UIProgressView during NSURLConnection download.

I am using this code: NSURLConnection *oConnection=[[NSURLConnection alloc] initWithRequest:oRequest delegate:self]; to download a file, and I want to update a progress bar on a subview that I load. For that, I use this code: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [oReceivedData appendDat...

Create a new delegate class for each asynchronous image download?

First, I'm using an NSURLConnection to download JSON data from twitter. Then, I'm using a second NSURLConnection to download corresponding user avatar images (the urls to the images are parsed from the first data download). For the first data connection, I have my TwitterViewController set as the NSURLConnection delegate. I've created a...

How to download a wav file from the web to a location on iPhone using NSFileHandle and NSURLConnection?

Hi all, I want to download a wav file from a web service, cache it on the iphone and playback it using AVAudioPlayer. Using NSFileHandle and NSURLConnection seems a viable solution when dealing with relatively large files. However, after running the app in the simulator I don't see any saved file under the defined directory (NSHomeDirect...

NSURLConnection POST also calls GET of same URL.

Hi all, I have a NSURLConnection which is a post to the server, but I expect it to return some small data, whether it was successful or not. -(void)submitPost:(NSString *)xml { NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[service generateURL]]; NSString *result = (NSString *) CFURLCrea...

progress while uploading file from iPhone

I'm uploading a file from an iPhone to a server with an HTTP POST, and monitoring the progress in NSURLConnection's connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite. The problem is that the progress is not smooth. The beginning of the file goes by very fast in four 32K chunks, then the progress ticks by more slowly ...

Troubleshooting FORM POST problems

I'm using the following code to submit to a WCF service. I keep getting an error that the key is invalid. I have a webpage on the same server that I submit the same data (but different key) using a FORM POST. It works fine that way. I put the URL below all in a URL (including valid key from server webpage) and get the key is invalid ...

iPhone SDK: How do you download video files to the Document Directory and then play them?

I've been fooling around with code for ages on this one, I would be very grateful if someone could provide a code sample that downloaded this file from a server http://www.archive.org/download/june_high/june_high_512kb.mp4, (By the way it's not actually this file, it's just a perfect example for anyone trying to help me) and then play it...

How to do long polling from iPhone application?

I want to create a iPhone chat application and i do not have any experience of socket programming so can u please help me understand How can i do long polling from iPhone application? Also can NSURLConnection be used for this purpose or we need to use some low level API? Are there any libraries available for the same? ...

Trying to launch App Store - getting ""in something not a structure or union" error

I am trying to launch the App Store without launching Safari with all the redirects and I am getting an error about "Request for member 'iTunesURL' in something not a structure or union." I am new to a lot of this so thank you for being patient with me. I think it has something to do with me calling "self.iTunesURL" since it doesn't th...

iPhone SDK: My server doesn't support range header requests, does that mean it's impossible for me to implement resumable downloads?

I am currently developing an iPhone app, in which involves downloads of up to 300 mb. I have been told by my hosting service that my server does not support range header requests. However, when I download a file from my server using a download client, like safari download manager, resume options are available and work. Does this mean ...

Send POSTs to a PHP script on a server

I have a PHP script on a server <?php // retrieve POST vars $comment = $_POST['comment']; $email = $_POST['email']; // remove trailing whitespace etc $comment = trim($comment); $email = trim($email); // format date accoring to http://www.w3schools.com/php/func_date_date.asp $date_time = date("Y-m-d-H-i-s"); // i.e. 2010-04-15-09-45-2...

[Obj-C/Cocoa] NSURLConnection leak issues

As a disclaimer I'd like to state that I'm fairly new to Objective-C and Cocoa. Currently I'm trying to write a basic application that can POST XML data to a particular endpoint. To achieve this, I've created a ServiceRouter class which uses NSURLConnection to post XML data to a particular URL. The ServiceRouter class is intended as a ...

SSL socket connection on iPhone

Is there a way to reuse SSL socket connections on the iPhone. I'm seeing an extra 3-4 second overhead in doing SSL handshaking. I'm using NSURLconnection currently to do the API calls and each one of them is taking 4-5 seconds on Wifi. Any suggestions would be greatly appreciated. ...

Objective-C SSL Synchronous Connection

Hello, I'm a little new to objective-C but have run across a problem that I can't solve, mostly because I'm not sure I am implementing the solution correctly. I am trying to connect using a Synchronous Connection to a https site with a self-signed certificate. I am getting the Error Domain=NSURLErrorDomain Code=-1202 "untrusted serve...

NSURLConnection/NSURLRequest gzip support!

Hi everyone! Does anyone knows if NSURLConnection/NSURLRequest have support for gzip requests. If does, can you provide more information? Thanks in advance! ...