我SQLite Manager
創建一個表,並將其導出到桌面,它的名字是db_fo_dic.sqlite
,我可以打開db_fo_dic.sqlite
使用SQLite Manager
,所以我的db_fo_dic.sqlite
複製到我的Xcode項目目錄我試圖通過FMDB
打開sqlite的文件,但它失敗:SQLite的文件,使用FMDB打開失敗
NSString *path = [[NSBundle mainBundle] pathForResource:@"db_fo_dic" ofType:@"sqlite"];
FMDatabase *db = [FMDatabase databaseWithPath:path];
結果的信息是: 2016-08-01 19:22:34.955 test_sqlite[15380:425242] The FMDatabase <FMDatabase: 0x7ff589c38f10> is not open.
這是我的SQLite的位置路徑: /Users/youpude/Library/Developer/CoreSimulator/Devices/87D0245A-47F7-4741-81B2-209625CB3C5E/data/Containers/Bundle/Application/47B3AD1F-C08E-4E34-8858-494A95FB9EA5/test_sqlite.app/db_fo_dic.sqlite
我測試之前你的答案複製我的sqlite沙箱,它沒有爲我工作。 – aircraft
而我只需要閱讀我的sqlite,但不能更新。 – aircraft
嘗試獲取路徑,如'NSString * path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@「db_fo_dic.sqlite」];'然後嘗試 – Lion