Integrating with 1Password

Episode #118 | 9 minutes | published on 05/08/2014
Subscribers Only
In this episode we talk about adding support for 1Password when creating your login forms. This is an easy technique that can add a nice touch to your applications if you need to support user login.

Episode Links

Source Code

There's no sense in showing a button that a user can't click on, so the best thing to do is just to hide the button unless we know they can respond to the URL.

- (NSURL *)passwordManagementURL {
  return [NSURL URLWithString:@"onepassword://search/twitter.com"];
}

- (void)viewDidLoad {
  [super viewDidLoad];

  if (! [[UIApplication sharedApplication] canOpenURL:[self passwordManagementURL]] ) {
    self.passwordManagementButton.hidden = YES;
  }
}

Next we just need to handle the tap and open 1Password:

- (void)passwordManagementTapped:(id)sender {
  [[UIApplication sharedApplication] openURL:[self passwordManagementURL]];
}
blog comments powered by Disqus