在iOS

时间:2018-02-22 06:37:08

标签: ios objective-c sqlite memory-management crash

我的应用使用sqlite作为后端数据库。我使用包装类来使用sqlite函数。当长时间使用应用程序时,它崩溃并显示sqlite.c中发生崩溃。我正在使用xcode 9.2和objective c。该应用程序仅针对ipads开发。 请帮忙。我还为崩解剂提供崩溃日志。以下是来自crashlytics的崩溃日志。

# Issue #: 245
# Issue ID: xxxxxxxxxxxxxxxxxx
# Session ID: xxxxxxxxxxxxxxxxx
# Date: 2017-12-14T14:29:00Z
# OS Version: 10.3.3 (14G60)
# Device: iPad Air 2
# RAM Free: 23.8%
# Disk Free: 70.4%

#7. Crashed: com.apple.root.default-qos
0  BCAS                           0x1011a1938 whereClauseClear (sqlite3.c:1031592)
1  BCAS                           0x101199908 whereInfoFree (sqlite3.c:998776)
2  BCAS                           0x101199908 whereInfoFree (sqlite3.c:998776)
3  BCAS                           0x101192520 sqlite3WhereEnd (sqlite3.c:969104)
4  BCAS                           0x10116f5c4 sqlite3Select (sqlite3.c:825908)
5  BCAS                           0x101167db4 yy_reduce (sqlite3.c:795172)
6  BCAS                           0x1011670fc sqlite3Parser (sqlite3.c:791916)
7  BCAS                           0x10111eef8 sqlite3RunParser (sqlite3.c:496488)
8  BCAS                           0x1011667b0 sqlite3Prepare (sqlite3.c:789536)
9  BCAS                           0x10111dee0 sqlite3LockAndPrepare (sqlite3.c:492368)
10 BCAS                           0x10111d3d0 sqlite3_prepare_v2 (sqlite3.c:489536)
11 BCAS                           0x1000f98f4 -[SQLWrapper ExecuteSelectQuery:] (SQLWrapper.m:218)
12 BCAS                           0x1000fb640 -[SQLWrapper getArrayByExecutingQuery:] (SQLWrapper.m:500)
13 BCAS                           0x1002d6e94 -[CascadeQueries getViolationCompletionStatus:] (CascadeQueries.m:2287)
14 BCAS                           0x10020c760 __48-[CascadingViewController checkCompletionStatus]_block_invoke (CascadingViewController.m:3360)
15 libdispatch.dylib              0x18d0929e0 _dispatch_call_block_and_release + 24
16 libdispatch.dylib              0x18d0929a0 _dispatch_client_callout + 16
17 libdispatch.dylib              0x18d0a10d4 _dispatch_queue_override_invoke + 644
18 libdispatch.dylib              0x18d0a2a50 _dispatch_root_queue_drain + 540
19 libdispatch.dylib              0x18d0a27d0 _dispatch_worker_thread3 + 124
20 libsystem_pthread.dylib        0x18d29b100 _pthread_wqthread + 1096
21 libsystem_pthread.dylib        0x18d29acac start_wqthread + 4



#0. com.apple.main-thread
0  libsystem_kernel.dylib         0x18d1d4e64 __psynch_mutexwait + 8
1  libsystem_pthread.dylib        0x18d2a0b8c _pthread_mutex_lock_wait + 96
2  libsystem_pthread.dylib        0x18d2a0d94 _pthread_mutex_lock_slow + 300
3  libobjc.A.dylib                0x18cc486f8 recursive_mutex_tt<false>::lock() + 16
4  libobjc.A.dylib                0x18cc4bf28 objc_sync_enter + 28
5  BCAS                           0x10020bf64 -[CascadingViewController insertInspectionStatusToSqlTable:] (CascadingViewController.m:3317)
6  BCAS                           0x100208d38 -[CascadingViewController changeColorCodeForView:WithCompleteFlag:WithStatus:] (CascadingViewController.m:2734)
7  BCAS                           0x1002bbd24 -[CascadingView completePbs:WithStatus:] (CascadingView.m:2526)
8  BCAS                           0x1002b68f0 -[CascadingView onCancelButtonClickInstance] (CascadingView.m:1505)
9  BCAS                           0x100186b94 -[InstanceInfo saveButtonClick:] (InstanceInfo.m:658)
10 UIKit                          0x1948d78d0 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 64
11 UIKit                          0x1948db104 _UIGestureRecognizerSendTargetActions + 124
12 UIKit                          0x1944950b4 _UIGestureRecognizerSendActions + 252
13 UIKit                          0x194336fc4 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 720
14 UIKit                          0x1948cb3a8 _UIGestureEnvironmentUpdate + 988
15 UIKit                          0x1948caf78 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 404
16 UIKit                          0x1948ca224 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 268
17 UIKit                          0x194335350 -[UIWindow sendEvent:] + 3164
18 UIKit                          0x194305f80 -[UIApplication sendEvent:] + 340
19 UIKit                          0x194affa20 __dispatchPreprocessedEventFromEventQueue + 2400
20 UIKit                          0x194afa17c __handleEventQueue + 4268
21 UIKit                          0x194afa5a8 __handleHIDEventFetcherDrain + 148
22 CoreFoundation                 0x18e18942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
23 CoreFoundation                 0x18e188d9c __CFRunLoopDoSources0 + 540
24 CoreFoundation                 0x18e1869a8 __CFRunLoopRun + 744
25 CoreFoundation                 0x18e0b6da4 CFRunLoopRunSpecific + 424
26 GraphicsServices               0x18fb21074 GSEventRunModal + 100
27 UIKit                          0x19436ac9c UIApplicationMain + 208
28 BCAS                           0x10021f040 main (main.m:14)
29 libdyld.dylib                  0x18d0c559c start + 4

#1. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x18d1b7224 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18d1b709c mach_msg + 72
2  CoreFoundation                 0x18e188e90 __CFRunLoopServiceMachPort + 192
3  CoreFoundation                 0x18e186ae4 __CFRunLoopRun + 1060
4  CoreFoundation                 0x18e0b6da4 CFRunLoopRunSpecific + 424
5  Foundation                     0x18ebd1db4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x18ebf2b84 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7  UIKit                          0x194cf4830 -[UIEventFetcher threadMain] + 136
8  Foundation                     0x18eccf318 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x18d29d68c _pthread_body + 240
10 libsystem_pthread.dylib        0x18d29d59c _pthread_body + 282
11 libsystem_pthread.dylib        0x18d29acb4 thread_start + 4

#2. com.twitter.crashlytics.ios.MachExceptionServer
0  BCAS                           0x1010e5ec0 CLSProcessRecordAllThreads + 262960
1  BCAS                           0x1010e5ec0 CLSProcessRecordAllThreads + 262960
2  BCAS                           0x1010e5d7c CLSProcessRecordAllThreads + 262636
3  BCAS                           0x1010d653c CLSHandler + 199084
4  BCAS                           0x1010d14e0 CLSMachExceptionServer + 178512
5  libsystem_pthread.dylib        0x18d29d68c _pthread_body + 240
6  libsystem_pthread.dylib        0x18d29d59c _pthread_body + 282
7  libsystem_pthread.dylib        0x18d29acb4 thread_start + 4

#3. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x18d1b7224 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18d1b709c mach_msg + 72
2  CoreFoundation                 0x18e188e90 __CFRunLoopServiceMachPort + 192
3  CoreFoundation                 0x18e186ae4 __CFRunLoopRun + 1060
4  CoreFoundation                 0x18e0b6da4 CFRunLoopRunSpecific + 424
5  CFNetwork                      0x18e8c3df4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6  Foundation                     0x18eccf318 __NSThread__start__ + 996
7  libsystem_pthread.dylib        0x18d29d68c _pthread_body + 240
8  libsystem_pthread.dylib        0x18d29d59c _pthread_body + 282
9  libsystem_pthread.dylib        0x18d29acb4 thread_start + 4

#4. com.apple.root.default-qos
0  libsystem_kernel.dylib         0x18d1d4e64 __psynch_mutexwait + 8
1  libsystem_pthread.dylib        0x18d2a0b8c _pthread_mutex_lock_wait + 96
2  libsystem_pthread.dylib        0x18d2a0d94 _pthread_mutex_lock_slow + 300
3  libobjc.A.dylib                0x18cc486f8 recursive_mutex_tt<false>::lock() + 16
4  libobjc.A.dylib                0x18cc4bf28 objc_sync_enter + 28
5  BCAS                           0x1002d69cc -[CascadeQueries getInspectionCompleteionStatus:AssetId:CategoryId:] (CascadeQueries.m:2222)
6  BCAS                           0x10020c710 __48-[CascadingViewController checkCompletionStatus]_block_invoke (CascadingViewController.m:3359)
7  libdispatch.dylib              0x18d0929e0 _dispatch_call_block_and_release + 24
8  libdispatch.dylib              0x18d0929a0 _dispatch_client_callout + 16
9  libdispatch.dylib              0x18d0a10d4 _dispatch_queue_override_invoke + 644
10 libdispatch.dylib              0x18d0a2a50 _dispatch_root_queue_drain + 540
11 libdispatch.dylib              0x18d0a27d0 _dispatch_worker_thread3 + 124
12 libsystem_pthread.dylib        0x18d29b100 _pthread_wqthread + 1096
13 libsystem_pthread.dylib        0x18d29acac start_wqthread + 4

#5. Thread
0  libsystem_kernel.dylib         0x18d1d5a88 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18d29afd0 _pthread_wqthread + 792
2  libsystem_pthread.dylib        0x18d29acac start_wqthread + 4

#6. Thread
0  libsystem_kernel.dylib         0x18d1d5a88 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18d29b1a4 _pthread_wqthread + 1260
2  libsystem_pthread.dylib        0x18d29acac start_wqthread + 4

#7. Crashed: com.apple.root.default-qos
0  BCAS                           0x1011a1938 whereClauseClear (sqlite3.c:1031592)
1  BCAS                           0x101199908 whereInfoFree (sqlite3.c:998776)
2  BCAS                           0x101199908 whereInfoFree (sqlite3.c:998776)
3  BCAS                           0x101192520 sqlite3WhereEnd (sqlite3.c:969104)
4  BCAS                           0x10116f5c4 sqlite3Select (sqlite3.c:825908)
5  BCAS                           0x101167db4 yy_reduce (sqlite3.c:795172)
6  BCAS                           0x1011670fc sqlite3Parser (sqlite3.c:791916)
7  BCAS                           0x10111eef8 sqlite3RunParser (sqlite3.c:496488)
8  BCAS                           0x1011667b0 sqlite3Prepare (sqlite3.c:789536)
9  BCAS                           0x10111dee0 sqlite3LockAndPrepare (sqlite3.c:492368)
10 BCAS                           0x10111d3d0 sqlite3_prepare_v2 (sqlite3.c:489536)
11 BCAS                           0x1000f98f4 -[SQLWrapper ExecuteSelectQuery:] (SQLWrapper.m:218)
12 BCAS                           0x1000fb640 -[SQLWrapper getArrayByExecutingQuery:] (SQLWrapper.m:500)
13 BCAS                           0x1002d6e94 -[CascadeQueries getViolationCompletionStatus:] (CascadeQueries.m:2287)
14 BCAS                           0x10020c760 __48-[CascadingViewController checkCompletionStatus]_block_invoke (CascadingViewController.m:3360)
15 libdispatch.dylib              0x18d0929e0 _dispatch_call_block_and_release + 24
16 libdispatch.dylib              0x18d0929a0 _dispatch_client_callout + 16
17 libdispatch.dylib              0x18d0a10d4 _dispatch_queue_override_invoke + 644
18 libdispatch.dylib              0x18d0a2a50 _dispatch_root_queue_drain + 540
19 libdispatch.dylib              0x18d0a27d0 _dispatch_worker_thread3 + 124
20 libsystem_pthread.dylib        0x18d29b100 _pthread_wqthread + 1096
21 libsystem_pthread.dylib        0x18d29acac start_wqthread + 4

用于执行查询的SqlWrapper代码:

-(sqlite3_stmt *)ExecuteSelectQuery:(NSString *)sqlSelectStatement
{
    if( nil == sqlSelectStatement || 0 == sqlSelectStatement.length )
    {
        NSLog(@"SQL ERROR! empty statement");
        return nil;
    }


    @synchronized(_sharedSQLWrapper)
    {
        if( !mIsDatabaseOpen )
        {
            short ret = [self OpenDatabase];
            if( SQLITE_OK != ret )
                return nil;
        }
        sqlite3_stmt *selectstmt;

        short ret = (short) sqlite3_prepare_v2(mDatabase, [sqlSelectStatement UTF8String], -1, &selectstmt, NULL);

        if( SQLITE_OK != ret)
            NSLog(@"SQL ERROR! %s", sqlite3_errmsg(mDatabase));
        if( SQLITE_OK != ret ) return nil;

        return selectstmt;
    }
}

请帮助......

0 个答案:

没有答案