I was struggling with the same error:
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID
My workaround is using UITextFieldDelegate.
I created a new string variable in my view controller, and then set my text field's delegate to self.
class ViewController : UIViewController {
private var textFieldText : String? = nil
private var myTextField : UITextField = {
//....... some code
}()
override func viewDidLoad() {
//....... some code
myTextField.delegate = self
}
}
Then i set this new string to text field's text after editing ends with the delegate method.
extension AddToGalleryVC: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
let text = textField.text
textFieldText = text
}
}
So i am using my new variable (textFieldText) instead of myTextField.text
Maybe an ugly solution but works for now.