我有一个应用程序,它的第一个场景是登录屏幕。按下登录按钮后,如果用户名和密码正确,则应调用下一个场景。否则会显示警报。但我无法弄清楚如何有条件地获得下一个场景。
if ([jsonDict valueForKey:@"success"] && [jsonDict valueForKey:@"redirect"]) {
NSLog(@"%@", [jsonDict valueForKey:@"success"]);
NSLog(@"%@", [jsonDict valueForKey:@"redirect"]);
NSString *redirect = [jsonDict valueForKey:@"redirect"];
[self performSegueWithIdentifier:@"next" sender:self];
}
else {
NSArray *jsonArray = [jsonDict valueForKey:@"errors"];
NSString *err = [jsonArray objectAtIndex:0];
NSLog(@"%@", err);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Credentials!" message:err delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}