我有以下代码:
- (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)theRequest{
strFinal = [theRequest responseString];
NSLog(@"Sattus Code : %@",[theRequest responseString]);
[self GoTo];
}
我正在使用 ASIHttp 进行登录。如果登录正常strFinal
设置为successfully
,否则设置为failed
。
我的GoTo
方法是
-(void)GoTo{
NSString *failStr = @"failed";
NSString *successStr = @"successfully";
if (strFinal == successStr) {
//Navigate to other xib
}else
if (strFinal == failStr) {
UIAlertView *AlertFail = [[UIAlertView alloc] initWithTitle:@"LogIn Failed !" message:@"Wrong ID or Password" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[AlertFail show];
}
}
}
strFinal
问题是除非失败,否则不会显示警报。