How to view data stored in Core Data?

前端 未结 11 676
醉酒成梦
醉酒成梦 2020-12-01 01:51

I\'m creating a Core Data model for my application. I would like to be able to look inside it to see what I have stored in there.

Is there an easier way tha

11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 02:41

    If you are using iOS 10 & Swift get it into your AppDelegate.swift:

      let container = NSPersistentContainer(name: "***")
      print(container.persistentStoreDescriptions.first?.url)
    

    Then you'll see something like that:

    Optional(file:///Users//Library/Developer/CoreSimulator/Devices/956F0003-5DA4-4588-97C1-A9A83767F341/data/Containers/Data/Application/9765FDE1-6971-4706-987B-96FBD3F462BF/Library/Application%20Support/***.sqlite)
    

提交回复
热议问题