nsurl

iPhone image upload in background.

I'm writing an app with an image upload feature. Right now I'm using NSURL POST like: 125306. When the app is closed as far as I can tell all of the uploads abort and the threads die. Is there 1) a way to make these upload threads persist when the app is no longer in the foreground? 2) an iPhone OS service that will accept requests ...

Iphone SDk : Problem with ampersand in the URL string

how do we pass a string Mr.X & Mr.Y in the URL. I have tried this but this one does all the chars but ampersand. [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] Thanks for the help. ...

extract data from cocoa http get request

I implemented the following code: NSURL *url = [ NSURL URLWithString:[ NSString stringWithFormat: @"http://www.google.com/search?q=%@", query ] ]; NSURLRequest *request = [ NSURLRequest requestWithURL: url ]; I want to extract the body from what I receive back from the url above. I attempted: NSData *data = [request HTTPBody]; The ...

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

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

Multiple parameters in NSURL object

I would like to pass multiple parameters from the iphone sdk to a server-side php which interfaces with a mySQL database. i found some answers on how to do this, but i'm having a hard time figuring out how to include several parameters. what i have right now is - (IBAction)sendButtonPressed:(id)sender { NSString *urlstr = [[NSSt...

iPhone NSData/NSUrl with cookie

Hi, I'm trying to play/stream a mp3 hosted on a website. The site requires a cookie header to be set, but I'm having trouble setting that or getting the container to do that for me. NSURL *sampleUrl = [NSURL URLWithString:@"http://domain/files/sample.mp3"]; NSData *sampleAudio = [NSData dataWithContentsOfURL:sampleUrl]; Up until ...

Objective-C Problems with NSDictionary and NSURL

Hi, I am new to Objective-C and I have no clue why this code is not working: NSMutableDictionary *bookmarks = [NSMutableDictionary dictionaryWithCapacity:(NSUInteger) 4]; [bookmarks setObject:@"Stanford University" forKey:[NSURL URLWithString:(NSString *) @"http://www.stanford.edu"]]; [bookmarks setObject:@"Apple" forKey:[NSURL URLW...

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

iphone sdk - Remove all characters except for numbers 0-9 from a string

OK So here's the plan. The XML I'm getting data from allows non-numeric text in phone number fields (for descriptions or contact names, etc). I am trying to extract only the numbers and call the tel: URL with them to initiate a call. Here's whats NOT working: NSCharacterSet *charset = [[NSCharacterSet decimalDigitCharacterSet] invertedS...

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

Want to show navigation bar while opening URL-iPhone

Hi All. I have been scratching my head for this issue. I hope the query title is self explanatory. On clicking a button i am opening URL like following: NSURL *girlsUrl=[NSURL URLWithString:[IMAGE_URL_GIRLS objectAtIndex:(indexValue*3 + currentPageNumber)]]; [[UIApplication sharedApplication]openURL:girlsUrl]; its opening a URL in sam...

Check if NSURL returns 404

Hi, I need to check whether a URL, represented by a NSURL is available or returns 404. What is the best way to achieve that? Thanks! heinrich ...

NSData & NSURL - url with space having problem

I have following code in my application. NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:pathOfThumbNail]]; pathOfThumbNail has following path http://70.84.58.40/projects/igolf/TipThumb/GOLF 58B.jpg When I open above path in safari browser - path is changed automatically & image is successfully displayed. http:/...

How do I specifically get a static Web image url and apply it to an iPhone application blank view?

In building an iphone app, I can render a blank view, (say that's all I have, just a generic, full screen view) and I want to populate in that view an image from the web, say, "http://www.mypicture.com/mypicture.jpeg". I want to do this as fast as the network allows and not use the photo roll or any part of the os that the user can see....

UIWebView: Error while loading URL

Hello, I am trying to build an RSS reader for the Tom's Hardware website. I have an error when I try to load an URL into an UIWebview from an RSS link. Here'is my code: - (void)viewDidLoad { [super viewDidLoad]; if (self.url != nil) { NSURL *requestUrl = [NSURL URLWithString:self.url]; NSURLRequest *requestObj = [NSURLRequest...

Saving video from UIImagePickerController to Core Data on iPhone OS

I need some guidance on how to save video data to core data so that I can retrieve it again later. I have no problem retrieving the NSURL that is returned from UIImagePickerController but then I'm not sure how to go about saving the video data to Core Data. I can already save and retrieve regular images from Core Data but I'm not sure h...

How to measure size of NSMutableURLRequest 's response before http-ungzip

One of my view needs a big JSON file for tableview. I use gzip in HTTP request, but want to be sure of size. The problem: How to measure size before and after ungzip? or how to know how strong gzip is? This my code sample: NSURL *url=[NSURL URLWithString:urlWithDate]; NSMutableURLRequest *urlR=[NSMutableURLRequest requestWithURL:url ...

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