我遇到了这个错误消息:“-[ASIFormDataRequest initWithURL:]: unrecognized selector sent to instance 0x93b4800 2013-07-02 11:07:25.603 DesignTable[1593:c07] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' -[ASIFormDataRequest initWithURL:]: 无法识别的选择器发送到实例 0x93b4800'"
-(void)sendBtnClicked:(UIButton*)sendBtn
{
for (int i = 0; i <tableArray.count; i++){
NSMutableDictionary *tableLocation = [NSMutableDictionary dictionaryWithObjectsAndKeys:[tableYcoord objectAtIndex:i], @"yCoord" ,[tableXcoord objectAtIndex:i],@"xCoord", nil];
[tableLocation setObject:[tableNameArr objectAtIndex:i] forKey:@"tableName"];
[tableLocation setObject:[tableIDArray objectAtIndex:i] forKey:@"tableID"];
[tableLocation setObject:[capacityArray objectAtIndex:i] forKey:@"capacity"];
[tableAttributes addObject:tableLocation];
//NSMutableDictionary *tableData = [NSMutableDictionary dictionaryWithObjectsAndKeys:tableLocation,@"tableLocation", nil];
NSMutableDictionary *finalDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:tableAttributes,@"table", nil];
NSError *error;
jsonData = [NSJSONSerialization dataWithJSONObject:finalDictionary
options:NSJSONWritingPrettyPrinted
error:&error];
aStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
url = [NSURL URLWithString:@"http://localhost/srvs/possrv/uploadTableDesign"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"POST"];
[request setValue:@"38" forKey:@"RestaurantID"];
[request setPostValue:jsonData forKey:@"json_data"];
[request startAsynchronous];
NSLog(@"%@", aStr);
sendBtn.enabled = NO;
}
这是我将 json 数据发送到我的网络服务的代码。