0

执行 Sqlite 库时,在 4 或 5 步后发现 BOOL 值为 '\x06' 而不是 'YES' BOOl 值将是 '\0' ..这个 BOOL 值有什么问题?

BOOL success;//success value is '\x06'
NSLog(@"success:%c",success);

//If the database is present then quit.
if(success)
{
    [self OpenDB:databasePath];
    return;
}

//the database does not exists, so we will copy it to the users document directory]

//Copy the database file to the users document directory.
success = [FileManager copyItemAtPath:dbPath toPath:databasePath error:&error];//  this place success value is '\0'

//If the above operation is not a success then display a message.
//Error message can be seen in the debugger's console window.
if(success)//
    NSAssert1(0, @"Failed to copy the database. Error: %@.", [error localizedDescription]);
[self OpenDB:databasePath];

Am checking success only....

NSLOG 输出成功:

4

1 回答 1

0

尝试使用 %d 而不是 %c 或尝试将默认值设置为成功,
例如BOOL success = NO;

NSLog(@"success: %d", success);
于 2012-09-11T12:02:37.243 回答