SwitchClientAlertController.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // SwitchClientAlertController.m
  3. // model
  4. //
  5. // Created by Drew on 2018/12/14.
  6. // Copyright © 2018 Mine. All rights reserved.
  7. //
  8. #import "SwitchClientAlertController.h"
  9. @interface SwitchClientAlertController ()
  10. @end
  11. @implementation SwitchClientAlertController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view from its nib.
  15. }
  16. - (IBAction)cancel:(id)sender {
  17. [self dismissViewControllerAnimated:YES completion:nil];
  18. }
  19. - (IBAction)jump:(id)sender {
  20. [self dismissViewControllerAnimated:YES completion:^(void){
  21. NSString *account = [[NSUserDefaults standardUserDefaults] stringForKey:@"account"];
  22. NSString *pwd = [[NSUserDefaults standardUserDefaults] stringForKey:@"pwd"];
  23. NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"chmoMember://login?mobile=%@&pass=%@", account, pwd]];
  24. [[UIApplication sharedApplication] openURL:url];
  25. if (@available(iOS 10.0, *)) {
  26. [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
  27. if (!success){
  28. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1434021876?mt=8"] options:@{} completionHandler:nil];
  29. }
  30. }];
  31. } else {
  32. if (![[UIApplication sharedApplication] canOpenURL:url]){
  33. [[UIApplication sharedApplication] openURL:url];
  34. } else {
  35. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1434021876?mt=8"]];
  36. }
  37. }
  38. }];
  39. }
  40. /*
  41. #pragma mark - Navigation
  42. // In a storyboard-based application, you will often want to do a little preparation before navigation
  43. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  44. // Get the new view controller using [segue destinationViewController].
  45. // Pass the selected object to the new view controller.
  46. }
  47. */
  48. @end