FMDatabaseQueue崩溃

时间:2017-08-01 15:52:16

标签: ios fmdb

我在我的应用中使用FMDB。我在应用程序发布期间看到这种随机崩溃。

-(void) addActivities{
[[[DB sharedManager]getSecureQueue] inTransaction:^(FMDatabase * _Nonnull db, BOOL * _Nonnull rollback) {

        //process data
 }];
}

getSecureQueue返回FMDatabaseQueue:

_secureQueue= [FMDatabaseQueue databaseQueueWithPath:dbPath];

我检查过_SecureQueue不是零。

崩溃日志:

Crashed: fmdb.<FMDatabaseQueue: 0x170242610>
0  libdispatch.dylib              0x18ad83634 _dispatch_barrier_sync_f_slow + 560
1  FMDB                           0x101040bd8 -[FMDatabaseQueue beginTransaction:withBlock:] (FMDatabaseQueue.m:228)
2  FMDB                           0x101040bd8 -[FMDatabaseQueue beginTransaction:withBlock:] (FMDatabaseQueue.m:228)
3  iPhoneHandheldACT              0x1001e4870 -[HHCTabBarController addActivities] (HHCTabBarController.m:145)
4  iPhoneHandheldACT              0x1001e553c __49-[HHCTabBarController migrateIntoRealm]_block_invoke (HHCTabBarController.m:226)
5  FMDB                           0x101040ac4 __30-[FMDatabaseQueue inDatabase:]_block_invoke (FMDatabaseQueue.m:188)
6  libdispatch.dylib              0x18ad729a0 _dispatch_client_callout + 16
7  libdispatch.dylib              0x18ad7fee0 _dispatch_barrier_sync_f_invoke + 84
8  FMDB                           0x101040a34 -[FMDatabaseQueue inDatabase:] (FMDatabaseQueue.m:202)
9  iPhoneHandheldACT              0x1001e4ce8 -[HHCTabBarController migrateIntoRealm] (HHCTabBarController.m:181)
10 iPhoneHandheldACT              0x1001e4270 -[HHCTabBarController viewDidLoad] (HHCTabBarController.m:77)
11 UIKit                          0x191fecb04 -[UIViewController loadViewIfRequired] + 1036
12 UIKit                          0x192004590 -[UIViewController __viewWillAppear:] + 132
13 UIKit                          0x192188e18 -[UINavigationController _startCustomTransition:] + 1144
14 UIKit                          0x1920a37bc -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
15 UIKit                          0x1920a3424 -[UINavigationController __viewWillLayoutSubviews] + 64
16 UIKit                          0x1920a3388 -[UILayoutContainerView layoutSubviews] + 188
17 UIKit                          0x191fe9cc0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
18 QuartzCore                     0x18f1da274 -[CALayer layoutSublayers] + 148
19 QuartzCore                     0x18f1cede8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
20 QuartzCore                     0x18f1ceca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
21 QuartzCore                     0x18f14a34c CA::Context::commit_transaction(CA::Transaction*) + 252
22 QuartzCore                     0x18f1713ac CA::Transaction::commit() + 504
23 QuartzCore                     0x18f171e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
24 CoreFoundation                 0x18be689a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
25 CoreFoundation                 0x18be66630 __CFRunLoopDoObservers + 372
26 CoreFoundation                 0x18bd96dc4 CFRunLoopRunSpecific + 456
27 UIFoundation                   0x191f95134 -[NSHTMLReader _loadUsingWebKit] + 1764
28 Foundation                     0x18c9af50c __NSThreadPerformPerform + 340
29 CoreFoundation                 0x18be6942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
30 CoreFoundation                 0x18be68d9c __CFRunLoopDoSources0 + 540
31 CoreFoundation                 0x18be669a8 __CFRunLoopRun + 744
32 CoreFoundation                 0x18bd96da4 CFRunLoopRunSpecific + 424
33 GraphicsServices               0x18d801074 GSEventRunModal + 100
34 UIKit                          0x192051c9c UIApplicationMain + 208
35 iPhoneHandheldACT              0x1000a7bf4 main (main.m:16)
36 libdyld.dylib                  0x18ada559c start + 4

1 个答案:

答案 0 :(得分:1)

在第8行,看起来你已经在<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteRule ^(.*) application/public/$1 [L] </IfModule> 电话中(即当你再次尝试进入队列时,你已经在inDatabase)。当你已经进入该串行队列时,不要尝试进入串行队列。充其量,你会陷入僵局。如果您在错误的时间(例如在应用启动期间)执行此操作,则监视程序进程将使用异常代码0x8badf00d(“吃不好的食物”; lol;请参阅Technical Note TN2151: Understanding and Analyzing Application Crash Reports)来终止您的应用。

相关问题