3 回答

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
我設(shè)法找到了sqlite文件,現(xiàn)在在此路徑中:
庫(kù)/開發(fā)人員/ CoreSimulator /設(shè)備/(數(shù)字和字母)/數(shù)據(jù)/容器/數(shù)據(jù)/應(yīng)用程序/(數(shù)字和字母)/文檔/
(數(shù)字和字母)代表您的應(yīng)用程序/計(jì)算機(jī)唯一的文件夾,但看起來(lái)像這樣:779AE2245-F8W2-57A9-8C6D-98643B1CF01A
我可以通過(guò)進(jìn)入appDelegate.m并向下滾動(dòng)到
- (NSURL *)applicationDocumentsDirectory
方法,以及NSLogging返回路徑,如下所示:
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
NSLog(@"%@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
這將為您提供獨(dú)特的路徑,使您更輕松,因?yàn)槭褂?個(gè)未命名的文件夾/字母和數(shù)字字符串查找它很棘手。
Swift 4.2:
let paths = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
print(paths[0])

TA貢獻(xiàn)1909條經(jīng)驗(yàn) 獲得超7個(gè)贊
試試這個(gè)簡(jiǎn)單的3個(gè)步驟
在下面的代碼復(fù)制didFinishLaunchingWithOptions你appdelegate.m和前添加一個(gè)破發(fā)點(diǎn)NSLog()
(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSLog(@"%@",[paths objectAtIndex:0]);
}
或在Swift中:
let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
print(paths[0])
2.打開Finder->轉(zhuǎn)到->轉(zhuǎn)到文件夾并粘貼從步驟1復(fù)制的路徑
- 3 回答
- 0 關(guān)注
- 618 瀏覽
添加回答
舉報(bào)