2
可能還有許多其他問題,我甚至不知道要問,因爲我是新手應用程序編程。捆綁sqlite數據庫與應用程序和stringByAppendingPathComponent錯誤
我最初從應用程序中創建的數據庫,它複製到我的工作文件夾(這可能不是它應該最終身居),然後將其附加我的記錄(其中約1000),從文本文件中。
首先想到的兩個問題是: - 數據庫應該在哪個文件夾中? - 它如何與應用程序一起部署?
我發現相當幾個例子使用persistentStoreCoordinator函數下列行:
NSString *storePath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"myDatabase.sqlite"];
NSURL *storeUrl = [NSURL fileURLWithPath:storePath];
但第一行給出我預編譯錯誤:「接收器類型‘NSURL’例如消息不聲明一個方法與選擇「stringByAppendingPathComponent:」爲什麼不是爲我工作
這其實是捆綁我的數據庫與應用程序的其餘部分的最佳方式
感謝
01?!
http://stackoverflow.com/questions/5002250/importing-sqlite-to-coredata – Kjuly 2012-02-16 07:22:11