nsurlconnection

Objective-C and NSURL: where am I supposed to declare receivedData?

I have a two classes, a controller called "AppController" and a class called "URLDelegate" that encapsulates the sample NSURL code from Apple's URL Loading System Programming Guide. The guide repeatedly mentions declaring the receivedData instance variable "elsewhere." I assume this means outside of the URLDelagate class, because if I ...

How to make an NSURL that contains a | (pipe character)?

Hi all, I am trying to access google maps' forward geocoding service from my iphone app. When i try to make an NSURL from a string with a pipe in it I just get a nil pointer. NSURL *searchURL = [NSURL URLWithString:@"http://maps.google.com/maps/api/geocode/json?address=6th+and+pine&bounds=37.331689,-122.030731|37.331689,-122.030731&...

[iPhone app] Inserting special char un NSString for URL use

Hi, I'm using HTTP connection to share data with my JSON server. I use URLs like "MyServlet?param1=value1" and so on... I'm now facing a problem with one of my servlet (I can't change it because some other views are using it) : The servlet is working with a syntax including those symbols "{" and "}". The exact syntax is {(value1_va...

leaks when using NSData, NSURL,NSMutableURLRequest,NSURLConnection and sendSynchronousRequest

Hi Guys, I am getting the leak at this line in below code" NSData *returnData = [NSURLConnection ..........." NSURL *finalURL = [NSURL URLWithString:curl]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:finalURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:...

NSURLConnection shown as leaking in instruments

Hello another stupid question regarding leaks and also NSURLConnection. How do i release it? Is it enough if i release in the following 2 methods? (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error (void)connectionDidFinishLoading:(NSURLConnection *)connection Because in instruments it shows me the line...

update UIProgressView.progress in VC-B with values generated in VC-A

- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { progBarReturn = (float) totalBytesWritten / totalBytesExpectedToWrite; Since that is a void delegate method. General qu...

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

iPhone App : Wireless connection fails after sleep...

I have a problem with a new app I am writing. The app connects to the internet to download an xml file which it uses in the app. It goes back regularly to sync the data - basically to check if it has changed. This all works fine but I am experiencing a problem if the iPhone has gone to sleep. When it wakes up 9 times out of 10 the wirele...

NSURLConnection hangs on recieving not too big amount od data

I have some code here: (...) NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if( theConnection ) { webData = [[NSMutableData data] retain]; } and delegate methods: -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { ...

Check if file on website exists

Hi, on the iPhone I want to check, if a specific file (test.licence) on a website exsists. My approach (so far) was to download the file and check if it exists in my Documents directory. However, if the file does not exists, Apache presents a HTML error page (which I download instead of test.licence). Checking the file size is a fuzzy s...

Reachability on iPhone app with a false positive - will it get past apple?!

I am using this code... Reachability *r = [Reachability reachabilityWithHostName:@"www.maxqdata.com"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" mes...

Leaks in NSURLConnection

Hi, I have googled a lot and read a lot about the leaks issue with NSURLConnection, but none of them gives a definite answer as to what is the solution to overcome these leaks. I create an asynchronous connection and every time the connection is established, I get a GeneralBlock-3584 leak. Sometimes the responsible library is shown to b...

NSURLConnection causes bad access crash

Hi Iam fighting with this for the past 48 hours searching all forums with no use. Iam using NSURLConnection asynchronous to download a series of web files, it randomly crashes ( after downloading a few files which is not fixed). Please see the call stack below: 0 0x35b634f4 in objc_msgSend 1 0x3527c2ca in CFEqual 2 0x3532e750 in __CFB...

iPhone NSURLConnection - delegates not working

Hello- I am trying to get an NSURLConnection to work in my app. I have followed apple's code almost exactly but it doesn't seem to work. The NSURLConnection is inside of a method called, downloadSave. This method runs properly through the end, and my log indicates, "Connection Exists" - however nothing happens after that as if none of th...

Iphone JPEG datastream contains no image using NSURLConnection

hello - I was previously downloading images for my app by using dataWithContentsOfURL to download a jpg then writeToFile to save it. I recent;y started using an NSURLConnetion to do the same, but now I am getting the follwoing errors and a crash: Corrupt JPEG data: 87 extraneous bytes JPEG datastream contains no image I know these ...

NSURLConnection and Javascript

I'm trying to log in into a web page through an iPhone app. I'm using a NSURLConnection to try to connect. The app seems to be logging in correctly but I'm then getting redirected to a page that says I can't continue without Javascript enabled. I'm running all of this through the iPhone simulator that comes packaged with xcode. The curio...

Problem while saving data to documents directory after file download by nsurlconnection iphone

Hi all, I'm using following code to save the downloaded file to iphone/ipod-touch's documents directory. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; [receivedData writeToFile:basePath atomically:YES]; The f...

Creating a single JSON Parser/Network object

Hello, What I'm looking for is a point in the right direction of helping me create a better concept of what I need to do within my application design. What I'm trying to do is have a class that will make network requests, IE: getUser, getTimeline, getLocation. Once the data has been recieived via -(void)connectionDidFinishLoading: have...

Does NSURLConnection Block the Main/UI Thread

I am downloading images in table view cells as they scroll onto the screen. For UX reasons, I start downloading the images in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath. I do not wait until the table view is done scrolling. When the table view cell is set, I start downloading i...

Obtaining broken XML followed by full XML from webservice

hi friends In my contact management app i am using webservice to get a large xml data, that contains contact details. i use NSURLConnection class for sending requests. But i am facing problem in while getting the XML . First i get a broken XML and then I am getting the whole XML data . Can anyone figure out what is going wrong in my app...