osx - Open Window for asking for Password to store in keychain in Swift 2.0 -
i tried much, doesn't work :-(
i have written class part this:
if usekeychain { let server : string = "smb://cloud.amrhein.info" let user : string = "gerald" let pwd : string = "password" let keychain = keychain(server: server, protocoltype: .smb) if let output : string = try! keychain.get(user) { print("password (if): \(output)") } else { print("start ask4pwd") var pwindowcontroller : nswindowcontroller? if let storyboard : nsstoryboard = nsstoryboard(name: "main",bundle: nil) nsstoryboard { if let vc = storyboard.instantiatecontrollerwithidentifier("passwordviewcontroller") as? passwordviewcontroller { let mywindow = nswindow(contentviewcontroller: vc) mywindow.makekeyandorderfront(self) pwindowcontroller = nswindowcontroller(window: mywindow) pwindowcontroller!.showwindow(self) } } { try keychain .accessibility(.always) .label("\(server) (\(user))") .comment("use mount volumes") .set(pwd, key: user) } catch let error { print(error) } } } else { password = passwordsarray[index!] } if password == "" { print("no password set - break!") break }
....
i have settled environment no password found. see "start ask4pwd" print in console!
the class running, window asking password not open when no password fount in keychain!
in mainstoryboard have created new view controller "passwordviewcontroller" , gave storyboard id: passwordviewcontroller
this view controller has no sequel main window controller!
i not want gui comes when app starts, have disabled "is initial controller" on mainwindowcontroller
i gogoled , viewed youtube videos lot - not reach goal...
who can me?
Comments
Post a Comment