nsurlconnection

A/Synchronous NSURLConnection: get response without download data?

Hi! Help is highly appreciated. I'm stuck here: I need to examine a response before I start loading an URL in my UIWebView. However a synchronous NSURLConnection will first download the data and then let me access the response, which is bad. An asynchronous NSURLConnection will let me examine the response before any data is received bu...

Cocoa: Checks required for multiple asynchronous NSURLConnections using same delegate functions?

This is with reference to the StackOverflow question Managing multiple asynchronous NSURLConnection connections I have multiple asynchronous HTTP requests being made at the same time. All these use the same NSURLConnection delegate functions. (The receivedData object is different for each connection as specified in the other question ab...

Upload and download data from server with Cocoa Touch?

How can I upload/download data from a server in Cocoa Touch. Here's what I have so far... -(void)uploadSchedule:(id)sender { NSData *content = [NSData dataWithContentsOfFile:self.dataFilePath]; NSString *stuff = [[NSString alloc] initWithData:content encoding:NSASCIIStringEncoding]; NSURL *url = [NSURL URLWithString:@"http://thetis....

NSURLConnection delegation and threading - iPhone

I have a class that updates two .plist files in the app documents directory via an NSURLConnection. The class acts as its own delegate for NSURLConnection. It works properly when I ask for a single file, but fails when I try to update two files. Does it look like I should start a new thread for each of the getNewDatabase messages? - ...

Loading form input values from web pages into URLRequest?

How would I pull out the form values for the html source below and add them to an NSURLConnection? <tr> <th><label for="username"><span class="accesskey">N</span>etID:</label></th> <td><input id="username" name="username" class="required" tabindex="1" accesskey="n" type="text" value="" size="32" autocomplete="false"/...

NSData initWithContentsOfURL: options: errorPtr: delegate object?

Is there a way to assign some sort of delegate object when [[NSData alloc] initWithContentsOfUrl:... options:... errorPtr:...] is called so that I can monitor percentage complete of a download or is the best way to handle this sort of thing through the use of the asynchronous NSURLConnection stuff? ...

Why aren't UItableViewCell images loading until scrolling?

My code downloads images asynchronously using InternetImage in the tableview: cellForRowAtIndexPath: method by initializing a IntentImage with initWithURL and calling downloadImage. This code runs perfectly after scrolling down to a new cell UITableViewCell in the UITableView, but not before, even though the URL is correct in both cases....

Handling a NSURLRequest with timeout when using delegate

I'm using a NSMutableURLRequest to connect to a web site to get a JSON response. I'm doing so by generating the request, and then using NSURLConnection with a delegate of self to handle the async connection. I've implemented all the normal delegate methods: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data...

Getting Image from URL/server

Hi All, I'm fairly new to iPhone development and I'm trying to fetch 'Images from Server' in my application. I'm using the following method to do this: enter code here - (UIImage *)imageFromURLString:(NSString *)urlString { NSURL *url = [NSURL URLWithString:urlString]; NSMutableURLRequest *request = [[NSMutableURLRequest al...

HTTP connection with NSURLConnection in iphone

Hi, Thanks a lot for reply. I am stuck here. Can you please help with this situation? Can CFHTTPStream will resolve this problem? Is there any other way to work with this problem ? Thanks. Hi, I am connecting to an HTTP url using NSURLConnection. I am supposed to get response after some time intervals (The response is not getting close...

NSURLConnection sendSynchronousRequest - is it possible to implement without leak

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? ...

How to get an NSarray of all file names in a directory on a remote server?

How do I get an NSArray of the NAMES of all files stored in a specific directory such as: "http://www.someurl/somedirectory/"? ...

NSURLConnection leak?

i have set up a nsurl which grabs the data from http. when i run instrument, it says i have a leak NSFNetwork object. and how do i release theConnection in (void)ButtonClicked? or it will be release later on? - (void)ButtonClicked { NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:KmlUrl] ...

NSURLConnection using basic auth fails on Tiger, succeeds on Panther and Leopard

I have a program running on Panther, Tiger, and Leopard systems and using the following method for NSURLConnection authentication ("encodedUserPass" is the auth string with the word Basic followed by the base64-encoded user:pass) [theRequest addValue:encodedUserPass forHTTPHeaderField:@"Authorization"]; NSURLConnection *theConnection=[[...

NSURLConnection works on simulator but fails on iphone device

I'm testing iphone application via xCode both simulation and on iphone device. On the simulation, there is no problem, but when running on the iphone device, NSURLConnection fails, connection:didFailWithError: method called. What can be the reason for this problem? ...

NSURLConnection "lost network connection" error ?

Hello, I am developing an app that will upload the image from the iphone to a server. In server side there is a php program to handle the uploaded image. I am using the NSURLConnection with the Post method and have set the post body of the request. When I upload the image, I could see the image uploaded 3 times(in the server), but after...

Is NSURLConnection thread safe?

I have multiple NSURLConnections running providing data back to the delegate objects. Is it safe for these delegate objects all to store their data into a single instance of an sqlite database connection? ie Do the callbacks to the delegates come back in on different threads? ...

Connection timed out problem when testing on iPhone device

When i test my iPhone application on simulator there is no problem. But when i try to test it on iPhone device via xcode, connection:didFailWithError is triggered and the localized description of the error is 'timed out'. What can be the reason for the time out on device? ...

NSURLDownload delegate methods on a separate thread

Hey, Is anyone aware of a way to receive NSURLDownload's delegate methods on a separate thread, i.e. not the main one? I am using an NSOperationQueue to manage them but at the moment I need to use the performSelectorOnMainThread method to get it too work. The problem with this is that it drives the kernel task crazy reaching about 30% o...

iPhone using NSURLConnection to get multipart data is not working right

It seems that there is a bug in the NSURLconnection when you are getting multipart files, didReceiveResponse doesn't get called like the docs say between each part (see this). So I think I'm going to parse all of the data that is coming in. The format is text and binary(images) does anyone know of any code already to parse the nsdata o...