diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 95d5ddc..297062d 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -851,7 +851,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 73; + CURRENT_PROJECT_VERSION = 75; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -875,7 +875,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 73; + CURRENT_PROJECT_VERSION = 75; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme b/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme index 2c56fd0..e1ebd13 100644 --- a/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme +++ b/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> diff --git a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 483bee5..618c809 100644 --- a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -63,21 +63,5 @@ landmarkType = "7"> - - - - diff --git a/AutoCat/Controllers/Location/EventsController.swift b/AutoCat/Controllers/Location/EventsController.swift index b203a09..0de3caa 100644 --- a/AutoCat/Controllers/Location/EventsController.swift +++ b/AutoCat/Controllers/Location/EventsController.swift @@ -5,6 +5,7 @@ import Realm import RealmSwift import PKHUD import MobileCoreServices +import ExceptionCatcher class EventPin: NSObject, MKAnnotation { var coordinate: CLLocationCoordinate2D @@ -344,7 +345,12 @@ class EventsController: UIViewController, UITableViewDataSource, UITableViewDele do { if let realm = self.vehicle?.realm { try realm.write { - realm.add(vehicle, update: .all) + do { + try ExceptionCatcher.catch { realm.add(vehicle, update: .all) } + } + catch { + self.showAlert(title: "Error updating vehicle", message: error.localizedDescription) + } } } else { self.vehicle?.events.removeAll() diff --git a/AutoCat/Controllers/SearchController.swift b/AutoCat/Controllers/SearchController.swift index d42cc56..89ad1ab 100644 --- a/AutoCat/Controllers/SearchController.swift +++ b/AutoCat/Controllers/SearchController.swift @@ -3,6 +3,7 @@ import RxSwift import RxCocoa import RealmSwift import PKHUD +import ExceptionCatcher class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDelegate, UIScrollViewDelegate { @@ -161,7 +162,12 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe if let realm = try? Realm() { if realm.object(ofType: Vehicle.self, forPrimaryKey: vehicle.getNumber()) != nil { try? realm.write { - realm.add(newVehicle, update: .all) + do { + try ExceptionCatcher.catch { realm.add(newVehicle, update: .all) } + } + catch { + self.showAlert(title: "Error updating vehicle", message: error.localizedDescription) + } } } }