0
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"the response string is %@",responseString);
if ([responseString isEqualToString:@"No Data Available"])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message"
message:@"No data Avilable in server"delegate:self cancelButtonTitle:nil otherButtonTitles:
@"OK", nil];
[alert show];
[alert release];
}
在我的connectiondidfinishload委託方法我有上面的代碼。當服務器回覆沒有數據時,由於某種原因它不會進入if循環。不知道爲什麼。任何提示將不勝感激。 謝謝。無法比較目標c中的responseString
但我的日誌經常說responseString等於「沒有數據可用」......這是否與NSLOG上方的行中的NSUTF8StringEncoding有關。 – Rajashekar 2011-01-24 10:10:36