0
我正在写一个应用程序,它将UIImage上传到我的服务器。这工作完美,因为我看到图片被添加。我使用UIImageJPEGRepresentation作为图像数据并配置一个NSMutableRequest。 (设置URL,HTTP方法,边界,内容类型和参数)使用UIImageJPEGRepresentation上传UIImage到服务器
我想显示的UIAlertView中当正在上传的文件和我写这个代码:
//now lets make the connection to the web
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
NSLog(@"return info: %@", returnString);
if (returnString == @"OK") {
NSLog(@"you are snapped!");
// Show message image successfully saved
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"You are snapped!" message:@"BBC snapped your picture and will send it to your email adress!" delegate:self cancelButtonTitle:@"OK!" otherButtonTitles:nil];
[alert show];
[alert release];
}
[returnString release];
的returnString输出:2010-04 -22 09:49:56.226 bbc_iwh_v1 [558:207] return info:OK
问题是我的if语句没有说returnstring == @“OK”,因为我没有得到AlertView。
我应该如何检查这个returnstring值?