Post

Replies

Boosts

Views

Activity

Reply to Autofilled password not working with bound value
Password AutoFill still doesn’t work with Cocoa bindings in macOS 11.3 beta 1 (20E5172i). I filed FB9007031. There is a workaround—you can observe NSControlTextDidChangeNotifications from each textfield and manually update your string properties. Example from my bug report: objc (void)viewDidLoad {     [super viewDidLoad];     if (kEnableWorkaround) {         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myControlTextDidChange:) name:NSControlTextDidChangeNotification object:self.usernameTextField];         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myControlTextDidChange:) name:NSControlTextDidChangeNotification object:self.passwordTextField];     } } /* these will also get called when typing; superfluous when already using bindings */ (void)myControlTextDidChange:(NSNotification *)note {     NSTextField *textField = (NSTextField *)note.object;     if ([textField isEqual:self.usernameTextField]) {         self.username = self.usernameTextField.stringValue;     } else if ([textField isEqual:self.passwordTextField]) {         self.password = self.passwordTextField.stringValue;     } }
Topic: App & System Services SubTopic: Core OS Tags:
Feb ’21