好像你正在存儲完整的路徑。
在IOS 8 Apple更改了目錄結構。在內部文件目錄中擴展文件夾(例如/ developer/data /一些隨機數字序列)。如果您存儲完整路徑在你的sqlite中,你沒有在該位置找到任何文件,因爲文檔目錄位置已經改變。
的解決方案是不存儲完整的路徑只是從文件目錄的路徑存儲到數據庫中,同時訪問圖像只是目前的申請文件目錄前綴,那麼你能夠從你的應用程序目錄訪問圖像
例如:
//Storing Images
NSString *imagePathString = [NSString stringWithFormat:@「/%@/%@.png」,@「Your Folder name」,@「image name」];
//Store this image path String to database
//Retrieving Images
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *filePath = [documentsPath stringByAppendingPathComponent:imagePathString];
//This is the path for your images
謝謝好信息 – skkrish 2014-11-13 10:09:53
WOW!只是完美的答案。你讓我的問題消失了! :) – xNightxOwl 2015-06-10 22:09:44