Skip to main content

Posts

Showing posts with the label nsmutableurlrequest

My first web-based iPhone application - how to do it right?

I've built my first web-based iPhone app and I have some performance issues that I needs to be resolved. I want to verify that I'm doing it right, so your feedback is really appreciated... :-) The application presenting data - images & text directly from my remote MySQL DB using PHP based web-services. I'm using the SDWebImage for lazy-downloading. Now, I wonder if I'm doing everything right or is there something needs to be modified for better performance - Each connection to the DB is handling via NSMutableURLRequest using POST method. It's running again if I receive time-out connection from the DB and displaying an alert-view if connection fails. There is only one PHP web-service for every operation - I mean - if, for instance, I'm running the remote getInfo.php script for fetching information from my DB to be presented on info-view-controller, there is only one copy of this script on my web-site, so everyone's ru

sending data to a webserver with NSMutableURLRequest

I am creating an iOS app that needs to send a post to a php script. the php script then takes these values and updates an xml file. I can't for the life of me figure out why this wouldn't work... Also how could I test to see whether or not the php script is actually receiving data? Here is my objective-c code: NSDate *now = [NSDate date]; NSString *rowString = [NSString stringWithFormat:@"%d", index.row]; // format the date NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"HH:mm"]; NSString *time = [formatter stringFromDate:now]; NSString *post = [NSString stringWithFormat:@"newTime=%@&newValue=%@&locationIndex=%@", time, coverAsString, rowString]; NSLog(@"the post data is %@ with row string: %@", post, rowString); NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];