我有一个附加了securecode的webservices url。当我输入正确的安全码例如说abcd时,应用程序将加载。当我输入错误的安全代码时,我需要将警告显示为'错误的安全代码'。我的代码是在这里不用..如何在ios应用程序中使用目标c输入错误的安全代码时显示警报
- (void) alertStatus:(NSString *)msg :(NSString *)Title:(int)tag
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:Title
message:msg
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
if(tag)
alertView.tag = tag;
[alertView show];
}
-(IBAction)loginClicked:(id)sender {
@try {
if([[txtsecurecode text] isEqualToString:@""] ) {
[self alertStatus:@"Please enter Access code" :@"Login Failed!":0];
} else {
NSString *post =[[NSString alloc] initWithFormat:@"txtsecurecode=%@",[txtsecurecode text]];
NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://my example.com/Accountservice/Security/ValidAccess?accesscode=%@&type=1",txtsecurecode.text]];
NSString *responseData = [[NSString alloc]initWithData:[NSData dataWithContentsOfURL:url] encoding:NSUTF8StringEncoding];
responseData就是我正在从网络服务响应url.so下方获得响应的参考,我需要保持警觉。
你能帮我在这种情况下保持警觉,当输入错误的安全代码时显示警报。提前致谢。
u需要定制UR验证逻辑...这是不是在我们的代码.. 。 – Ganapathy 2013-03-19 05:57:53
根据您可以管理的响应。 – Balu 2013-03-19 05:58:59
您可以使用您在responseData中获得的数据,然后在此基础上,您可以显示警报 – Kasaname 2013-03-19 06:00:33