Xcode 8中sql lite数据库的位置在哪里?
问题描述:
我试图找到SQL数据库精简版的Xcode 8下所使用的iPhone模拟器这是我在寻找的路径:Xcode 8中sql lite数据库的位置在哪里?
Library/Developer/CoreSimulator/Devices/4E8D17D7-BA66-4FED-8A4A-0AF7CCE6DFB7/data/Containers/Data/Application/9C5D7B38-D014-4CD9-A75B-7C6343A1E096/Documents
我可以看到其他的文件,我已经创建的,但可以”没有看到任何sql lite数据库。我正在使用核心数据并保存检索记录。我怎么找到它?
感谢
答
假设你有一个容器是这样的:在的AppDelegate在didFinishLaunchingWithOptions打印验证码
let container = NSPersistentContainer(name: "HitList")
现在:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let directory = NSPersistentContainer.defaultDirectoryURL()
let url = directory.appendingPathComponent("HitList" + ".sqlite")
print("My SQL Location")
print (url)
return true
}
你会发现路径的sqlite。如果您发现难以搜索,请按命令+空间进行聚光灯搜索,在聚光灯搜索中输入〜/ Library,您将解锁通常隐藏的图书馆。然后按照从xcode获得的路径进行操作。希望有所帮助。