为什么FMDB会在两个不同的线程上崩溃两个不同的实例?

时间:2017-11-16 18:03:53

标签: ios multithreading fmdb

我已实例化并使用两个FMDatabase实例,每个实例位于不同的类中,并带有指向两个不同数据库的路径。

根据我的理解,这个用法不应该是下面主线程崩溃的原因,但我可能会弄错。如果确实是撞车事故背后的原因,有人可以帮我理解原因吗?

主线程:

  Crashed: com.apple.main-thread
0  libsqlite3.dylib               0x18461d9f0 (null) + 972
1  libsqlite3.dylib               0x18461d9c4 (null) + 928
2  libsqlite3.dylib               0x1846a4644 (null) + 37328
3  libsqlite3.dylib               0x1846acb14 (null) + 71328
4  libsqlite3.dylib               0x1846abdb4 (null) + 67904
5  libsqlite3.dylib               0x1846370c4 (null) + 9180
6  libsqlite3.dylib               0x184635b7c sqlite3_step + 3732
              [*CRASH*]
7  FMDB                           0x100d55950 -[FMResultSet nextWithError:] (FMResultSet.m:165)
8  ZiiZii                         0x100713d68 specialized static CatalogManager.countItems() -> Int (CatalogManager.swift:157)
9  ZiiZii                         0x10079ad34 specialized CustomerInfoCell.render(Customer!, isCatalogAvailable : Bool?, for : UIViewController, at : IndexPath?) -> () (CatalogManager.swift)
10 ZiiZii                         0x1007a7a34 specialized MainController.(viewDidLoad() -> ()).(closure #1).(closure #2).(closure #2).(closure #1).(closure #1) (MainController.swift)
11 ZiiZii                         0x1007afbc0 partial apply for MainController.(viewDidLoad() -> ()).(closure #1).(closure #2).(closure #2).(closure #1).(closure #2) + 4304190400
12 ZiiZii                         0x10084cf20 DynamicTableRow.(show(String, onRender : (UITableViewCell) -> ()) -> ()).(closure #1) (DynamicTableRow.swift:111)
13 ZiiZii                         0x1008661b8 specialized DynamicTableSection.cellForRow(UITableView, rowIndex : Int) -> UITableViewCell (DynamicTableRow.swift:157)
14 ZiiZii                         0x100676d58 specialized DynamicTable.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (DynamicTableSection.swift)
15 ZiiZii                         0x100675edc @objc DynamicTable.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (DynamicTable.swift)
16 UIKit                          0x18d96b948 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 664
17 UIKit                          0x18d96beac -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
18 UIKit                          0x18d813934 -[_UITableViewUpdateSupport(Private) _setupAnimationsForNewlyInsertedCells] + 5188
19 UIKit                          0x18d80f9f0 -[_UITableViewUpdateSupport _setupAnimations] + 208
20 UIKit                          0x18d80f3a8 -[UITableView _updateWithItems:updateSupport:] + 2456
21 UIKit                          0x18d7f6fe0 -[UITableView _endCellAnimationsWithContext:] + 15456
22 UIKit                          0x18d7f328c -[UITableView endUpdates] + 92
23 ZiiZii                         0x100675948 DynamicTable.performUpdates() -> () (DynamicTable.swift:213)
24 ZiiZii                         0x1006e935c DynamicTableViewController.refresh(Bool) -> () (DynamicTableViewController.swift)
25 ZiiZii                         0x1007a0ba4 MainController.viewWillAppear(Bool) -> () (MainController.swift:421)
26 ZiiZii                         0x1007a0c00 @objc MainController.viewWillAppear(Bool) -> () (MainController.swift)
27 UIKit                          0x18d64996c -[UIViewController _setViewAppearState:isAnimating:] + 628
28 UIKit                          0x18d6496e0 -[UIViewController __viewWillAppear:] + 156
29 UIKit                          0x18d6d46c8 -[UINavigationController viewWillAppear:] + 440
30 UIKit                          0x18d64996c -[UIViewController _setViewAppearState:isAnimating:] + 628
31 UIKit                          0x18d6496e0 -[UIViewController __viewWillAppear:] + 156
32 UIKit                          0x18d97c734 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 1152
33 UIKit                          0x18d8a0f74 _runAfterCACommitDeferredBlocks + 292
34 UIKit                          0x18d894318 _cleanUpAfterCAFlushAndRunDeferredBlocks + 288
35 UIKit                          0x18d623ac8 _afterCACommitHandler + 132
36 CoreFoundation                 0x1841a1848 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
37 CoreFoundation                 0x18419f200 __CFRunLoopDoObservers + 412
38 CoreFoundation                 0x18419f7bc __CFRunLoopRun + 1292
39 CoreFoundation                 0x1840bffb8 CFRunLoopRunSpecific + 436
40 GraphicsServices               0x185f57f84 GSEventRunModal + 100
41 UIKit                          0x18d6942f4 UIApplicationMain + 208
42 ZiiZii                         0x10064fc20 main (AppDelegate.swift:23)
43 libdyld.dylib                  0x183be256c start + 4

后台主题:

com.apple.root.default-qos
0  libsystem_kernel.dylib         0x183cf2ebc fsync + 8
1  libsqlite3.dylib               0x18465ec58 (null) + 59172
2  libsqlite3.dylib               0x18465e50c (null) + 57304
3  libsqlite3.dylib               0x18464addc (null) + 21892
4  libsqlite3.dylib               0x1846181b0 (null) + 3472
5  libsqlite3.dylib               0x184644540 (null) + 63576
6  libsqlite3.dylib               0x184635b7c sqlite3_step + 3732
7  FMDB                           0x100d50ae0 -[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] (FMDatabase.m:1104)
8  FMDB                           0x100d50f1c -[FMDatabase executeUpdate:withArgumentsInArray:] (FMDatabase.m:1198)
9  ZiiZii                         0x100793000 specialized static LabelsManager.createLabel(format : LabelFormat?, item : CatalogItem?) -> Label? (LabelsManager.swift:66)
10 ZiiZii                         0x1007beebc specialized MainPrintingFeature.(lookupBarcode(String, String, (ScannerResponse) -> ()) -> ()).(closure #1) (LabelsManager.swift)
11 ZiiZii                         0x1007bcb10 partial apply for MainPrintingFeature.(lookupBarcode(String, String, (ScannerResponse) -> ()) -> ()).(closure #1) (MainPrintingFeature.swift)
12 libdispatch.dylib              0x183b7d088 _dispatch_call_block_and_release + 24
13 libdispatch.dylib              0x183b7d048 _dispatch_client_callout + 16
14 libdispatch.dylib              0x183b84090 _dispatch_queue_override_invoke$VARIANT$mp + 716
15 libdispatch.dylib              0x183b8a1c8 _dispatch_root_queue_drain + 596
16 libdispatch.dylib              0x183b89f10 _dispatch_worker_thread3 + 120
17 libsystem_pthread.dylib        0x183e23120 _pthread_wqthread + 1268
18 libsystem_pthread.dylib        0x183e22c20 start_wqthread + 4

0 个答案:

没有答案