Post

Replies

Boosts

Views

Activity

Thread 13: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
I think the error is coming from here but I don't know what is my problem      //validate the fields     let error = validateField()     if error != nil{       // there is something wrong with the fields, show error message       showError(error!)     }     else{       //create celaned versions of the data       let first_name = firstNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)       let last_name = lastNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)       let email = emailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)       let password = passwordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)       //create users       Auth.auth().createUser(withEmail: email, password: password) { (result, err) in         //check for errors         if err != nil {           //there was an error creating users           self.showError("Error creating user")         }         else{           //user create successfully, now store f and l name           let db = Firestore.firestore()           db.collection("users").addDocument(data: ["first_name":first_name, "last_name":last_name, "uid": result!.user.uid]) {(error) in             if error != nil {               //show error message               self.showError("User name couldn't be save in database")             }           }           //transition to home screen           self.transtionToHome()         }       }     }        }     **and here is the error message: ```libsystem_kernel.dylib`__pthread_kill:**   0x7fff70173004 <+0>: movl  $0x2000148, %eax     ; imm = 0x2000148    0x7fff70173009 <+5>: movq  %rcx, %r10   0x7fff7017300c <+8>: syscall  -> 0x7fff7017300e <+10>: jae  0x7fff70173018      ; <+20> Thread 14: "-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x6000005ad8f0"   0x7fff70173010 <+12>: movq  %rax, %rdi   0x7fff70173013 <+15>: jmp  0x7fff7016d1c5      ; cerror_nocancel   0x7fff70173018 <+20>: retq     0x7fff70173019 <+21>: nop      0x7fff7017301a <+22>: nop      0x7fff7017301b <+23>: nop
4
0
712
Oct ’22
Map doesn't pop up require user location, and it doesn't show my current location. It just appears as a map
import SwiftUI struct MapView: View {   @State var showHome = false   @StateObject private var viewModel = MapViewModel()           var body: some View {     ZStack {       Map(coordinateRegion: $viewModel.region, showsUserLocation: true)           .ignoresSafeArea()           .accentColor(Color(.systemPink))           .onAppear{             viewModel.checkLocationAuthorization()         } //      VStack { //        Image("Back") //          .padding([.leading, .top]) //          .frame(maxWidth: .infinity,alignment: .leading) //          .onTapGesture{ //            showHome.toggle() //        } //        Spacer() //      }               }.overlay(RootView()) //    if showHome{ //      HomeView() //    }   } } struct MapView_Previews: PreviewProvider {   static var previews: some View {     MapView()   } } final class MapViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {       @Published var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 33.748997, longitude: -84.387985), span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))       var locationManager: CLLocationManager?       private func checkLocationServiceEnable() {     if CLLocationManager.locationServicesEnabled() {       locationManager = CLLocationManager()       locationManager?.desiredAccuracy = kCLLocationAccuracyBest       locationManager!.delegate = self                     }else{       print("Your location service is off")     }   }       func checkLocationAuthorization() {     guard let locationManager = locationManager else {return}           switch locationManager.authorizationStatus {             case .notDetermined:       locationManager.requestWhenInUseAuthorization()     case .restricted:       print("Location is restricted")     case .denied:       print("You have denied location permission, go to settings to change it")     case .authorizedAlways, .authorizedWhenInUse:       region = MKCoordinateRegion(center: locationManager.location!.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))     @unknown default:       break     }   }       func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {     checkLocationAuthorization()   } }
0
1
748
Oct ’22