-1

I know this question already answered before but when I tried to print the path for the sqlite file of my application as below I got the path but could not go to it in finder. I used below code to get the path

    let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last! as String
    print(paths)

The path I got is as below: /var/mobile/Containers/Data/Application/5412CDDE-8D40-46B2-A61D-65065796F7CE/Documents

when I try to copy and paste it in GOTO it can not find it

please advise me

shallowThought
  • 19,212
  • 9
  • 65
  • 112
rania
  • 57
  • 7
  • Possible duplicate of [Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone](http://stackoverflow.com/questions/38064042/access-files-in-var-mobile-containers-data-application-without-jailbreaking-iph) – muescha Jan 21 '17 at 00:53

3 Answers3

2

In case you are using NSPersistantContainer, you get the URL(s):

persistentContainer.persistentStoreCoordinator.persistentStores.first!.url!
shallowThought
  • 19,212
  • 9
  • 65
  • 112
0

when I try to copy and paste it in GOTO it can not find it

that path is on the Simulator and not on the local Finder.

Duplicate of: Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone

or

Duplicate of: How to view the data in sqlite file running in iphone application?

How to find the path of sqlite.sql file and print it?

accessing your sqlite database is described here:

Copy Sqlite DataBase in Swift does not work properly

Community
  • 1
  • 1
muescha
  • 1,544
  • 2
  • 12
  • 22
0

Use this in your swift class to get the location of sqlite database for your application running in iOS simulator.

let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
print(urls[urls.count-1] as URL)

You will need SQLite database browser to look after the database. We can only locate sqlite database file only for application running in simulator but not in the iPhone directly.

dev
  • 451
  • 4
  • 10
  • 23