SQLite操作中的随机EXC_BAD_ACCESS

时间:2017-07-05 06:45:43

标签: ios objective-c sqlite exc-bad-access ios-sqlite

我们在我们的应用程序中使用SQLite数据库。我们有足够的选择,更新和插入SQLite操作。我们的应用程序在CrashAnalytics中以下堆栈跟踪随机崩溃。

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x736e617274206f72
0  libsqlite3.dylib               0x18de5143c sqlite3_rekey + 112316
1  libsqlite3.dylib               0x18de51438 sqlite3_rekey + 112312
2  libsqlite3.dylib               0x18de51474 sqlite3_rekey + 112372
3  libsqlite3.dylib               0x18de51474 sqlite3_rekey + 112372
4  libsqlite3.dylib               0x18ddd1b2c sqlite3_log + 36424
5  libsqlite3.dylib               0x18de52688 sqlite3_rekey + 117000
6  libsqlite3.dylib               0x18ddcab20 sqlite3_log + 7740
7  libsqlite3.dylib               0x18ddb067c sqlite3_exec + 20292
8  libsqlite3.dylib               0x18ddac9a4 sqlite3_exec + 4716
9  libsqlite3.dylib               0x18ddac1d0 sqlite3_exec + 2712
10 libsqlite3.dylib               0x18ddabf24 sqlite3_exec + 2028
11 My App                    0x10010abb8 -[DataHelper getAccountType:] (DataHelper.m:6677)
12 My App                    0x1001a69e4 -[InvoicePurchase postInvoiceAlert:] (InvoicePurchase.m:3203)
13 libdispatch.dylib              0x18c7629e0 <redacted> + 24
14 libdispatch.dylib              0x18c7629a0 <redacted> + 16
15 libdispatch.dylib              0x18c7675e8 _dispatch_main_queue_callback_4CF + 996
16 CoreFoundation                 0x18d8590c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
17 CoreFoundation                 0x18d856ce4 __CFRunLoopRun + 1572
18 CoreFoundation                 0x18d786da4 CFRunLoopRunSpecific + 424
19 GraphicsServices               0x18f1f1074 GSEventRunModal + 100
20 UIKit                          0x193a42470 UIApplicationMain + 208
21 My App                    0x1001b719c main (main.m:18)
22 libdyld.dylib                  0x18c79559c <redacted> + 4

以下是SQLite代码:

sqlite3_stmt *statement=NULL;
NSString* accountType = NULL;
NSString *querySQL = [NSString stringWithFormat: @"SELECT a_type FROM account_detail WHERE aname=\"%@\"", accountName];
const char *query_stmt = [querySQL UTF8String];
if (sqlite3_prepare_v2(dbNameCompany, query_stmt, -1, &statement, NULL) == SQLITE_OK) //Line 6677 of DataHelper.m
{
    if (sqlite3_step(statement) == SQLITE_ROW)
    {
        accountType = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 0)];
    } 
    else 
    {
    }
}
sqlite3_finalize(statement);
return accountType;

任何帮助?

0 个答案:

没有答案