NSString *postString = [NSString stringWithFormat:@"~WriteMessage#%@#%@#4#我爱你#3#0", [Person sharedInstance].userID, bizID];NSData *postData = [postString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];NSLog(@"post data = %@", postString);NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",KUrl]]];[request setHTTPMethod:@"POST"];[request setHTTPBody:postData];[NSURLConnection connectionWithRequest:request delegate:self];
解决方案 »
- 使用定时器隐藏控件的疑惑
- iphone怎么把自己收到的消息显示到任务栏上提示给用户?
- 在电脑上,怎么用C++调用iTunesMobileDevice.dll连机iPhone?
- 求助:IPhone上传图片到服务器
- IOS zxing库 如何使用PDF417Reader
- 在我的View里如何实现iphone 按Home键后完全退出,即下次进来也调用viewDidLoad
- 流量压缩软件的流量统计原理
- 按下变灰这个功能如何做?
- Xcode addChildViewController 与 addSubview
- xcode7安装SDWebImage的步骤
- 一个小问题,求解释
- MKPinAnnotationView怎样添加一个蓝色的圆点,和其它大头针
传到服务器的数据的编码是UTF-8,在服务器看到是乱码,那说明服务器解析数据采用的可能不是UTF-8,使用中文操作系统,默认的编码是GBK,微软官方是这么说的。
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];