Post

Replies

Boosts

Views

Activity

Reply to App store release crashing
I guess what I'm saying with that comment (not actually in the code) is that line 39 is never getting executed. I can confirm with the backend API. So no statusCode either. Here is my code for the biometrics prompt: func promptTouchOrFaceID() {     //create context for touch auth     let authenticationContext = LAContext()     var error: NSError?     authenticationContext.localizedFallbackTitle = ""     let biometricType = authenticationContext.biometricType     //check if the device has a fingerprint sensor, exit if not     guard authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {       let title = "Error"       var message = ""       switch biometricType {       case .faceID:         message = "This device does not have a FaceID sensor or the sensor is not enabled."       case .touchID:         message = "This device does not have a TouchID sensor or the sensor is not enabled."       case .none:         message = "This device does not have any sensors to use TouchID or FaceID"       }               AlertService.showAlert(on: self, title: title, message: message)       UserDefaults.standard.set("False", forKey: UserDefaultsKeys.usesBiometrics)       removeLoadingSpinner()       return     }     authenticationContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Please use your fingerprint to authenticate.", reply: { [unowned self] (success, error) - Void in       if (success) {         //fingerprint recognized, set this possible and go to view controller         OperationQueue.main.addOperation({ () - Void in           self.fillInUserDetails()           self.login_now(username:self.tfUsername.text!, password: self.userDefaults.string(forKey: UserDefaultsKeys.password)!, customer: self.tfCustomerID.text!)         })       }     })   } On line 22 I guess this is not a main dispatch, but wouldn't this cause a problem under normal use too? I am running on my own device and with a fresh install I get the correct prompt to use face id. I'm really suspicious of the UserDefaults since this happens only when the app isn't run for a long time. Thanks
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to App store release crashing
sorry for the late reply. i can try replacing lines 38 with this but it won't even get to this point. I really think i have a misunderstanding of how UserDefaults works though and i'm finding out i cant look at the production version of my app's plist to see what's stored. I was thinking like on line 14 where i check to see if a UserDefault value is "True" I should check for nil first but this doesn't break when run as a fresh install and all of them are nil. The piece that makes this so difficult is I can't debug my app store version that is crashed and can't reproduce the error in development. Is there a difference in the way UserDefaults are stored in release vs. development?
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21