asiformdatarequest

Insert into remote database ASIFormDataRequest: Getting 400 Code, Bad Request

混江龙づ霸主 提交于 2019-12-13 08:11:24
问题 I am trying to insert data into a database on a webserver. I am using MySQL, Appache and PHP Xcode *-(IBAction)saveRecord:(id)sender{ UITextField *description_txtfield = (UITextField*)[self.tableView viewWithTag:11]; description_string = description_txtfield.text; NSLog(description_string); NSURL *url = [NSURL URLWithString:@"http://192.168.1.140/~admin/qw/"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:description_string forKey:@"product_name"

ASIFormDataRequest works on simulator but not on device?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 18:34:47
问题 I am using ASIFormDataRequest to post three values which are a url, a title and a summary. All of them works fine on simulator but its not working on device. Here are the code that I'm using: - (IBAction)addLinkPressed:(UIButton *)sender { ASIFormDataRequest *loginRequest = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://MyWebsite.com/login.php"]]; [loginRequest setRequestMethod:@"POST"]; [loginRequest setPostValue:[[NSUserDefaults standardUserDefaults] objectForKey:@

ASIFormDataRequest POST Request Issue

情到浓时终转凉″ 提交于 2019-12-10 12:22:52
问题 im using this code to post data to my server NSURL *mainurl = [NSURL URLWithString:@"http://xxxxxxxxxx/api/PhonePaymentApi/Transaction/"]; NSString * postdata = [[NSString alloc]initWithFormat:@"UniqueId=%@&jsonProduct=%@&BranchId=%@&OrderToTime=%@",GETUnicidentifire,JsonOrderDetail,BranchId,OrderToTime]; ASIFormDataRequest *requestt = [ASIFormDataRequest requestWithURL:mainurl]; [requestt setRequestMethod:@"POST"]; [requestt addRequestHeader:@"application/x-www-form-urlencoded" value:@

Converting NSArray -> JSON -> NSData -> PHP server ->JSON representation

守給你的承諾、 提交于 2019-11-27 19:52:53
I am converting an Array of NSDictionaries to JSON data with the following... Create my data... NSMutableArray *arrayOfDicts = [[NSMutableArray alloc] init]; for (int i = 0; i < 2; i++) { NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: @"MySong", @"title", @"MyArtist", @"artist", nil]; [arrayOfDicts addObject:dict]; } NSArray *info = [NSArray arrayWithArray:arrayOfDicts]; NSData* jsonData = [NSJSONSerialization dataWithJSONObject:info options:NSJSONWritingPrettyPrinted error:&error]; then send like so... NSURL *url = [NSURL URLWithString:@"http://www.mywebsite.com/index.php"];

Converting NSArray -> JSON -> NSData -> PHP server ->JSON representation

假如想象 提交于 2019-11-26 20:06:41
问题 I am converting an Array of NSDictionaries to JSON data with the following... Create my data... NSMutableArray *arrayOfDicts = [[NSMutableArray alloc] init]; for (int i = 0; i < 2; i++) { NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: @"MySong", @"title", @"MyArtist", @"artist", nil]; [arrayOfDicts addObject:dict]; } NSArray *info = [NSArray arrayWithArray:arrayOfDicts]; NSData* jsonData = [NSJSONSerialization dataWithJSONObject:info options:NSJSONWritingPrettyPrinted error: