When I enter email and password information in my Login screen and tap either "Log in" or "Create Account" I get this message in my app error message in app and in my console I am receiving this message:
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID
I have tried searching various forums on StackOverflow and Apple Developer forums but I have not seen any solution posted.
- Authentication View that is called after the RootView(), this is where the error is occurring
import SwiftUI
import Combine
struct IdentifiableError: Identifiable {
let id = UUID()
let message: String
}
struct AuthView: View {
@ObservedObject var viewModel: JobApplicationViewModel
@State private var email: String = ""
@State private var password: String = ""
@State private var storedEmail: String = "" // Separate variable to hold the email
@State private var storedPassword: String = "" // Separate variable to hold the password
@State private var showingLogin = false
@State private var showingCreateAccount = false
@State private var identifiableError: IdentifiableError?
@FocusState private var isInputActive: Bool // For iOS 15+
var body: some View {
VStack {
Image(systemName: "briefcase.fill")
.resizable()
.scaledToFit()
.frame(width: 120, height: 120)
.padding()
Text("Welcome to Job Tracker Pro")
.font(.largeTitle)
TextField("Email", text: $email)
.autocapitalization(.none)
.keyboardType(.emailAddress)
.disableAutocorrection(true)
.padding()
.border(Color.gray)
.onChange(of: email) { [email] in
storedEmail = email
}
.onSubmit {
storedEmail = email // Store the email when submit the field
}
SecureField("Password", text: $password)
.padding()
.border(Color.gray)
.onChange(of: password) { [password] in
storedPassword = password
}
.onSubmit {
storedPassword = password // Store the password when submit the field
}
Button("Log In") {
hideKeyboard() // Dismiss the keyboard
// Use storedEmail and storedPassword to log in
// If you're handling login directly in AuthView
viewModel.logIn(email: storedEmail, password: storedPassword) { success, message in
// Handle completion
}
showingLogin = true
}
.padding()
Button("Create Account") {
hideKeyboard() // Dismiss the keyboard
// Use storedEmail and storedPassword to create an account
// If you're handling account creation directly in AuthView
viewModel.createAccount(email: storedEmail, password: storedPassword) { success, message in
// Handle completion
}
showingCreateAccount = true
}
.padding()
}
.alert(item: $identifiableError) { error in
Alert(
title: Text("Error"),
message: Text(error.message),
dismissButton: .default(Text("OK")) {
identifiableError = nil
}
)
}
.onReceive(viewModel.$error) { error in
if let error = error {
identifiableError = IdentifiableError(message: error.localizedDescription)
}
}
}
}
#if canImport(UIKit)
extension View {
func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
#endif
Please reply back if you have any insight on what might be causing this or if you have any questions about the code or any other views, view models, or models that I have implemented.
2
Answers
It is a different problem for me, but with the same error.
In react-native I’m using the "expo-image-picker".
I had been incorrectly calling the ImagePicker.launchImageLibraryAsync function in React Native. Here’s my initial approach:
The correct approach involves using promises instead of a callback. Here’s the corrected code:
Now the "RTIInputSystemClientremoteTextInputSessionWithID:performInputOperation" error is gone.
Your FocusState should be optional "enum". See Apple documentation. If you set focused(focusStateName, equals: .case) and then somewhere { focusStateName = nil }, the warning is away.