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值?