I have a NSView that when opened, the third NSTextField on it becomes FirstResponder to set the cursor there. If I open this form and start typing then click a save button then the NSTextField.stringValue in code is empty, even though it contains characters on the view. If I click off the field just before clicking the save button then the field stringValue is available in code.
I am sure this worked in the past, any ideas what is going on? I tried resigning firstResponder on save and making the save button the firstResponder when clicked etc.
My only solution at the moment is to not make it First Responder and force the user to click in the field, write something then click the save button which works.
XCode 9.1 (9B55)
Many thanks for any help.
As Willeke asked in comments how I set and removed first responder I noticed that I had, incorrectly set it as:
[self.textfield becomeFirstResponder]
The docs state that this should not be used and the correct method is:
if ([self.textfield acceptsFirstResponder])
[self.textfield.window makeFirstResponder:self.textfield];
Thanks Willeke!