nsurlrequest

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

how to post a login to a web form and keep the session -iphone sdk

iphone sdk question: I need to login to a web app and keep the session (session cookie) and then get an xml feed. I haven't found a good example for this. ...

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. How do I grab just HTTP header information?

The title to this question says it all. NSURLRequest + NSHTTPURLResponse is clearly the way to role. How do I just grab the header info? Cheers, Doug ...

Class NSURLRequest. Method - (NSInputStream *)HTTPBodyStream always returns nil. Why?

I am trying to use NSURLRequest with NSURLConnection to establish a binary stream connection to an HTTP server to retrieve a humungous data file in small, incrementally pieces. I see the method - (NSInputStream *)HTTPBodyStream on NSURLRequest. Is that the method I want to call on my instance of NSURLRequest? If so why does it alway ret...

I need the correct syntax for the setValue:forHTTPHeaderField: method on NSMutableURLRequest

I am pulling my hair out trying to conjure up the correct syntax to set the HTTP header information do a byte-range load from an HTTP server. This is the offending method on NSMutableURLRequest - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field This is how I am using this method to load the first 512 byte of a URL...

What is the Proper Way to Dynamically Create Content For a UIView?

I have a tableView with a list of items. When a selection is made, a new view controller is pushed on the tableView's navigationController viewController stack. My question is this: one of the views in the view hierarchy associated with the pushed view controller requires the fetching of data from the network before it can render it's c...

show progress bar when uploadingan image to my server

Hi, my app upload an image to my server. i want to show this event by a progress bar. (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite (void)connection:(NSURLConnection *)connection didRece...

sending XML file from IPhone to a server using Post Method

I am trying to send the data to server from my Iphone client. It works fine for most values but when itry to send a string like "IPhone+Cocoa" the server shows the string as "IPhone Cocoa". I have tried to google it but without success is there any why of doing it. Here is my code -(void)sendRequest:(NSString *)aRequest { NSMutableUR...

Bug with NSURLConnection.....?

I am trying to send the data to server from my IPhone client. It works fine for most values but when i try to send a string like "IPhone+Cocoa" the server shows the string as "IPhone Cocoa". I have tried to google it but without success is there any why of doing it. Here is my code -(void)sendRequestNSString *)aRequest { NSMutableURLR...

Does NSURLConnection take advantage of NSURLCache?

I'm trying to figure out how to use the URL loading framework to load URLs taking advantage of caching. I am using NSURLConnections and feeding them NSURLRequests. I have even set the cachePolicy on those requests to NSURLRequestReturnCacheDataElseLoad. The first time I load a request, it does automatically get put in the cache ([NSUR...

NSMutableURLRequest timeout doesn't trigger if data starts to load but not webViewDidFinishLoad

I am loading a UIWebview and requesting a URL that can take some time to finish loading. The request starts and begins to receive data. However, it doesn't appear that the request finishes. The webViewDidFinishLoad never triggers nor does the webView didFailLoadWithError: callback. Does a timeout of a NSURLRequest only occur if ther...

NSURLConnection NSURLRequest proxy for asynchronous web service calls

I have multiple views which make the same NSURLRequest/NSURLConnection request. Ideally, in order to get some code reuse, I'd like to have some sort of a "proxy" which does all the underlying work of creating/executing the (asynchronous) request/connection, setting up all the delegate methods, etc., so I don't have to copy all those NSUR...

Alternative method for NSURLRequest's private "setAllowsAnyHTTPSCertificate:forHost:"?

My iPhone application was rejected solely for using the (very safe, it seems) private method +setAllowsAnyHTTPSCertificate:forHost: for NSURLRequest. Is there a non-private API to emulate this functionality? ...

How to check if a file exists at particular URL?

Dumb question, but how do I check if a file exists on a web site. I am using NSURLConnection with my NSURLRequest and an NSMutableData object to store what comes back in the didReceiveData delegate method. In the connectionDidFinishingLoading method I then save the NSMutableData object to the file system. All good. Except if the file...

Profile Image Update Twitter API

I am trying to upload a profile image to twitter using their API. I found some good examples on the web on how to format the URLRequest, however I just can't seem to get this to work. Any help would be appreciated. The URL that I am using from Twitter API is http://twitter.com/account/update_profile_image.json -(void)uploadImageForAccou...

Mutable NSHTTPURLResponse or NSURLResponse

I need to modify response headers in an NSURLResponse. Is this possible? ...

Which schemes does NSURL / NSURLRequest / NSURLConnection understand?

Apple says, NSURL is developed using RFC 1738 (and some others). Now RFC 1738 specifies only that an web URL has a scheme and a scheme specific part. I want to know all the schemes which NSURL understands. And because I use it with NSURLRequest and NSURLConnection (the so called "URL Loader System"), I must know all the schemes which ...

Why is there no NSHTTPURLProtocol class?

Well, NSURLProtocol is pretty generic right? It is for defining all kinds of protocols, isn't it? So why is there nothing like NSHTTPURLProtocol? Instead, there is an informal category on NSURLRequest with specific HTTP stuff. Why did they do that this way? Why no custom HTTP protocol instead? What's the idea behind putting all this st...

How Do I Upload Multiple Files Using the iPhone

I am posting (HTTP POST) various values to the posterous api. I am successfully able to upload the title, body, and ONE media file, but when I try to add in a second media file I get a server 500. They do allow media and media[] as parameters. How do I upload multiple files with the iPhone SDK? ...