// // SwitchClientAlertController.m // model // // Created by Drew on 2018/12/14. // Copyright © 2018 Mine. All rights reserved. // #import "SwitchClientAlertController.h" @interface SwitchClientAlertController () @end @implementation SwitchClientAlertController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - (IBAction)cancel:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } - (IBAction)jump:(id)sender { [self dismissViewControllerAnimated:YES completion:^(void){ NSString *account = [[NSUserDefaults standardUserDefaults] stringForKey:@"account"]; NSString *pwd = [[NSUserDefaults standardUserDefaults] stringForKey:@"pwd"]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"chmoMember://login?mobile=%@&pass=%@", account, pwd]]; [[UIApplication sharedApplication] openURL:url]; if (@available(iOS 10.0, *)) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { if (!success){ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1434021876?mt=8"] options:@{} completionHandler:nil]; } }]; } else { if (![[UIApplication sharedApplication] canOpenURL:url]){ [[UIApplication sharedApplication] openURL:url]; } else { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1434021876?mt=8"]]; } } }]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end