应用程序崩溃(并非所有时间)消息" Exc_bad_access"
// 1. Get the path for phone DB
const char * dbpath = [self.DBPath UTF8String];
// 2. Open database
if (sqlite3_open(dbpath, &_contactDB) == SQLITE_OK)
{
// 3. Create request
NSString * statementGetBillingAccount = [NSString stringWithFormat:@"SELECT billing_account FROM account;"];
const char * sql_stmt_getBillingAccount = [statementGetBillingAccount UTF8String];
// 4. Execute request
sqlite3_stmt * sqlStatement;
int sqlResult = sqlite3_prepare_v2(_contactDB, sql_stmt_getBillingAccount, -1, &sqlStatement, NULL);
并停在
行int sqlResult = sqlite3_prepare_v2(_contactDB, sql_stmt_getBillingAccount, -1, &sqlStatement, NULL);
在xCode / console中,sqlite3_stmt * sqlStatement为NULL:
self AccueilViewController * class name = AccueilViewController 0x1696c800
sqlResult int 665035512 665035512
sql_stmt_getBillingAccount const char * "SELECT billing_account FROM account;" 0x15e7cac9
sqlStatement sqlite3_stmt * NULL 0x00000000
statementGetBillingAccount NSString * @"SELECT billing_account FROM account;" 0x15e7cac0
_contactDB sqlite3 * 0x15e7cb00 0x15e7cb00
有人能解释我发生了什么吗?谢谢