nsurlrequest

NSURLConnection not "firing" until UITableView scrolls..

Hi, I've got a UITableView that loads an image asynchronously and places it in the UITableViewCell once it's loaded (I'm using almost the exact same code as in the "LazyTableImages" tutorial). This works fine for all images when I scroll the table, but it's not loading the images that are first in the view. The code is definitely worki...

How can I get NSURLResponse body?

Hi, I'm writing an application that connect with a server using NSURLConnection. In the delegate method didreceiveresponse:, if the status code is 404, I cancel the connection and I would like to show a message with a custom error that is generated in the server. The problem is that from response object, I only can get statuscode, he...

Error while loading UIWebView

Hi all, I have created a UIWebView using interface builder. When I load the webview with loadRequest method, I get an error as below "<Error>: CGImageSourceGetType image source parameter is nil" What is this error due to ?? Thanks. ...

iPhone: Crash in Custom Autorelease Pool

My app is crashing when I try to post images in an HTTP request. I am trying to upload images to a server. The crash appears related to my autorelease pool because the crash is trapped at the [pool release] message. Here is the crash report: #0 0x326712f8 in prepareForMethodLookup () #1 0x3266cf5c in lookUpMethod () #2 0x32668f28 i...

UIWebView Error

Hi all, I am getting an error while loading a url in uiwebview "malloc: * error for object 0x2841000: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug" But when i change the url to google.com ,it works fine without any error. what is this error due to ? ...

cURL command to NSURLRequest

I want to convert cURL command: curl -F 'access=xxxx' \ -F 'message=Hello.' \ -F '[email protected]' \ https://example.com to a NSURLRequest. Can somebody please help me with this? ...

Getting leak in leak in [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil]

Hi all, I am having a leak in returnData= [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil]; The below is the code i am using NSString* curl = @"https://Some Url?ticket="; curl = [curl stringByAppendingString:self.ticket]; curl = [curl stringByAppendingString:@"&apikey=hjgajgfjaghjf&XM...

How to handle NSURLRequest HTTP error 303?

When I run my NSURLRequest in Cocoa, I get a 303 HTTP error, which is a redirect. How can I pull the proper URL to redirect to? Is it in the error variable, or somewhere else? ...

Get content of webservice

Hi there, I've got a problem which I thought is pretty simple to fix but somehow I can't figure out what to do. I've got an URL like http://www.myserver.com/myservice.php?param=foobar. When I type that into Safari's address bar I see an result like "Error" or "OK". So, how do I properly call that URL from within my code and get that re...

Fastest way for iPhone to contact Web server just to create a log entry

I track user activity in my iPhone app by having certain user actions call an almost empty Web page that the app does nothing with. Rather, attached to the URL are some querystring paramaters that tell me who's doing something and what it is (after I analyze the logs, that is). I don't want launching the URL to slow down the app, so I p...

downloading a movie file and placing it in the Videos directory... is that possible

I want to programattically pull a movie file down into a NSData object and write it to iPhone disk in the movies directory so that the user can open up their iPhone iPod section and watch the movies from there... Is that possible? Or do I need within my app to create a 'viewing' area, download the files to NSHomeDirectory add a folder i...

HTTP POST request not working over 3G

Hi there, When making the following HTTP POST request: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSURLResponse *urlResponse = nil; NSError *error = nil; // execute NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningRespons...

Weird problems on iPhone simulator but not device?

I'm having some problems with the iPhone simulator that don't seem to be occurring on the device. I have made a web service reference class with a bunch of static methods so different calls to a web service can be made from all over the application. The methods themselves contain a lock so only one request will be performed at a time. ...

Get remote file size via HTTP without downloading said file.

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

What to do with my data after connectionDidFinishLoading from NSURLRequest

I'm writing a class that uses a JSON API for a website I visit. In my class I use NSURLRequest to fetch the data, but then I need to give the data to the app delegate. I realize NSURLRequest is asynchronous so I can't directly return the data. So let's say in my class, the delegate calls getUserProfile, the method uses NSURLRequest to g...

Accepted Method for Retrying URL Request in Objective-C?

I have a connection request working using the stringWithContentsOfURL:encoding:error: method from NSString. I want to be able to retry the connection if it fails the first time. I was going to rewrite the function to use the timeout functionality of NSURLRequest, but I think I'd really like to use multiple retries before failing out. As...

NSURLRequest cannot handle HTTP body when method is not POST?

Whenever I set a body on a mutable request with the method set to anything other than POST, the body is not included in the request and I get a kCFErrorDomainCFNetwork error 303 (kCFErrorHTTPParseFailure) when the server replies. Changing the method to POST is all it takes for the request to go through with no error. Is there any way to ...

File backed UIImageView vs. NSURL Cache Control Policies

I am working on an image heavy iPad app. We implemented our own table view-esque control which reuses UIImageViews as a user scrolls the screen. To reduce network calls and make it perform better, I implemented a file backed UIImageView that writes the loaded images to the NSTemporaryDirectory and checks that before making a call to get ...

NSURLRequest Bad Request (400) to IIS Server

Hi I am building an iPhone app the retrieves a file from an IIS7 server. I'm using a plain old NSURLRequest to retrieve this file. The request works fine if I use another web server, but for some reason this one keeps giving me a 400 bad request. So I took a look at the request the NSURLRequest sends, and it looks like this: ::1 [Wed S...

Help sending cookie value with iphone request.

I am saving a cookie value and then trying to send it back with a later request to use for authentication... it doesn't seem to be working. NSString *savedCookie = [savedData objectForKey:@"savedLoginCookie"]; NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlAddress]]; [requestObj addVa...