Additional error handling
This commit is contained in:
parent
ed0e2a444b
commit
03824f3ed4
@ -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;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
version = "1.3">
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
|
||||
@ -63,21 +63,5 @@
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "A2917113-DA52-4374-ADE1-6BB476EC9BD9"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "AutoCat/Controllers/CheckController.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "401"
|
||||
endingLineNumber = "401"
|
||||
landmarkName = "check(number:action:force:)"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user