Episode #118

Integrating with 1Password

9 minutes
Published on May 8, 2014

This video is only available to subscribers. Get access to this video and 510 others.

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]];
}