I have the following code with these drop down lists and even an autocomplete at the bottom. These are all built into form and work nicely until a keyboard is presented in iOS. Then I get the following error:
Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.
and this: **-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID **
I ran the backtrace but it looks like Chinese to me.. Can someone tell me what I am doing wrong?
struct CreatePersonView: View { @Environment(\.dismiss) private var dismiss @ObservedObject var vm: EditPersonViewModel @State private var phoneDropDown = false @State private var emailDropDown = false @State private var hasError = false @State private var selectedLocation: MKMapItem? @State internal var searchResults: [MKMapItem] = [] @State private var searchText = "" @State internal var debounceTimer: Timer? var body: some View { ZStack { Form { Section("General") { TextField("First Name", text: $vm.personEntity.firstName) .keyboardType(.asciiCapable) TextField("Last Name", text: $vm.personEntity.lastName) .keyboardType(.default) TextField("Title", text: $vm.personEntity.title) .keyboardType(.default) } Section { TextField("Cell", text: $vm.personEntity.mobile) .keyboardType(.phonePad) TextField("Phone", text: $vm.personEntity.phone1) .keyboardType(.phonePad) if phoneDropDown == true { TextField("Fax", text: $vm.personEntity.fax) TextField("Alternate Phone", text: $vm.personEntity.phone2) } } header: { phoneListHeader } Section { TextField("Email", text: $vm.personEntity.email1) if emailDropDown == true { TextField("Email 2", text: $vm.personEntity.email2) TextField("Email 3", text: $vm.personEntity.email3) } } header: { emailListHeader } if vm.hasOrg != true { if selectedLocation == nil { TextField("Add Location", text: $searchText) List(searchResults.prefix(2), id: \.self) { item in Button { print(item) handleSelection(item: item) selectedLocation = item searchResults = [] } label: { AutoCompleteRow(item: item) } } } else { if let selectedLocation = selectedLocation { AutoCompleteRow(item: selectedLocation) } else { Text("Error") } } } } } .navigationTitle(vm.isNew ? "New Contact" : "Update Contact") .alert("Error", isPresented: $hasError, actions: {}) { Text("Please add a Name, City and State") } .toolbar { ToolbarItem(placement: .confirmationAction){ Button("Done") { validate() } } ToolbarItem(placement: .navigationBarLeading) { Button("Cancel") { dismiss() } } } .onChange(of: searchText) { debounceSearch(query: searchText) } } } some of the private views pulled out
private var phoneListHeader: some View { HStack{ Text("Phone") Spacer() Button { withAnimation(.easeInOut) { phoneDropDown.toggle() } } label: { Text("More") .font(.caption) Image(systemName: "arrow.down") .rotationEffect(Angle(degrees: phoneDropDown ? 180 : 0)) } } } private var emailListHeader: some View { HStack{ Text("E-mail") Spacer() Button { withAnimation(.easeInOut) { emailDropDown.toggle() } } label: { Text("More") .font(.caption) Image(systemName: "arrow.down") .rotationEffect(Angle(degrees: emailDropDown ? 180 : 0)) } } } ** And the backtrace **
Backtrace: 101039558 1010de0e0 2d60000000000000

Источник: https://stackoverflow.com/questions/780 ... namic-form