the app crash with this error message (Exc_bad_access (code=1, address=0x208)). the line where the app stops and the error appears is the last one (var result). this is the code:

// 1. Get the name and the path for DB
self.DBName = @"PhonePager.db";
NSArray * documentsPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentDir = [documentsPaths objectAtIndex:0];
self.DBPath = [documentDir stringByAppendingPathComponent:self.DBName];
const char * dbpath = [self.DBPath UTF8String];

// 2. Open database
if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)

    // 3. Create requests ( fill the table messages received )
     NSString * statementGetDataFromDB = [NSString stringWithFormat:@"SELECT id_message, date, time, ack_required, auto_ack_sent, message, titre, idfrom FROM messages m WHERE NOT EXISTS(SELECT id_message FROM responses r WHERE r.id_message = m.id_message) ORDER BY date DESC, time DESC"];

    const char * sql_stmt_getDataFromDB  = [statementGetDataFromDB UTF8String];

    // 4. Execute request
    sqlite3_stmt * sqlStatement;
    int result = sqlite3_prepare_v2(contactDB, sql_stmt_getDataFromDB, -1, &sqlStatement, nil);

Do you have some advices please? Thanks in advance

Related posts

Recent Viewed