agilebits / onepassword-app-extension

1Password Extension for iOS Apps
2.58k stars 311 forks source link

Black screen when being logged in #361

Closed gregorpichler closed 7 years ago

gregorpichler commented 7 years ago

I'm facing an issue where the app extensions works great if I'm not logged in to my 1Password app, however if I'm trying it a second time (after logging in previously), I can see the unlock animation in the app and then the screen turns black.

This happens when trying to create a password, calling storeLogin with the following code:

static func createOnePasswordLogin(email: String, fromViewController: UIViewController, sender: Any, completion: @escaping (_ username: String?, _ password: String?) -> ()) {
  let loginDetails: [String : Any] = [
  AppExtensionTitleKey: self.title,
  AppExtensionUsernameKey: email,
  AppExtensionNotesKey: self.notes
  ]

  let passwordGenerationOptions: [String : Any] = [
  AppExtensionGeneratedPasswordMinLengthKey: (12),
  AppExtensionGeneratedPasswordForbiddenCharactersKey: "!@#$%/0lIO"
  ]

  OnePasswordExtension.shared().storeLogin(forURLString: self.url, loginDetails: loginDetails, passwordGenerationOptions: passwordGenerationOptions, for: fromViewController, sender: nil) { (loginDictionary, error) -> Void in
    let username = loginDictionary?[AppExtensionUsernameKey] as? String
    let password = loginDictionary?[AppExtensionPasswordKey] as? String

    completion(username, password)
  }
}
gks commented 7 years ago

Hi @gregorpichler

This is actually a bug in the app itself, not the app extension. One we are aware of but do not have a super simple fix for. It will hopefully be resolved in 1Password 7, when that becomes available in the future. That's when it's slated to be resolved anyway.

For now, the easiest way to prevent this is to enable Lock on Exit in the Security preferences, and enable either Touch ID or PIN to more easily unlock. But the kicker is that Lock on Exit option, with that off this issue will happen, with it on it won't.

Sorry about that though!