0
執行Sqlite庫,在4或5個步驟後,我們將BOOL值作爲'\ x06'而不是'YES'。BOOl值將爲'\ 0'。這個BOOL值有什麼問題?布爾值' x06'而不是默認值'YES'
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輸出是成功的:
我們展示的代碼。 – trojanfoe
您在設置之前是否真的檢查過「成功」的價值,還是您在複製代碼時犯了錯誤? – hvd