I am searching for my SQLLite DB in my Simulator.
Based on ActivityMonitor, I am able to get the folder path of my Application.
/Users/MyMacBook/Library/Developer/CoreSimulator/Devices/A4170C16-A10B-4B48-9C7B-2A310F68B35F/data/Containers/Bundle/Application/F6C6772C-021A-4B27-874D-071B402DDBCC/
Though i couldn't find the SQLite database. I work on VS 2015 Xamarin Project.
How should i find SQLite db on my Simulator ?
Find the location of sqlite file by using the code in your appDelegate
in the `didFinishLaunchingWithOptions'
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
print(FileManager.default.urls(for: .documentDirectory, in: .userDomainMask))
}
Every time when running the app, your can find the location printed in the Xcode console.
I'm using application simMagnifier to view the SQLite file
By default , most SQLite
libraries/frameworks will place the Sqlite file in the root of your .app
.
When you establish your SQLite connection if you are supplying a path and a filename to your SQLite file, then follow that path.
sqlite-net
: var db = new SQLiteConnection("StackOverflow.sqlite");
cd Library/Developer/CoreSimulator/Devices
find $PWD -name "StackOverflow.sqlite" -print
/Users/sushi/Library/Developer/CoreSimulator/Devices/1EB2B821-E86B-4E9A-9814-1BBEF8FF1AA1/data/Containers/Bundle/Application/11BE399A-F802-4410-8163-32F5A90EB2FF/SQLiteLocation.app/StackOverflow.sqlite
Path.GetTempPath
: var db = new SQLiteConnection(Path.Combine(Path.GetTempPath(), "StackOverflow.sqlite"));
cd Library/Developer/CoreSimulator/Devices
find $PWD -name "StackOverflow.sqlite" -print
/Users/sushi/Library/Developer/CoreSimulator/Devices/1EB2B821-E86B-4E9A-9814-1BBEF8FF1AA1/data/Containers/Data/Application/EED6E9CE-7437-48DD-904D-5F9D5E8AC78F/tmp/StackOverflow.sqlite
I use to use SimPholders (but it's paid). I found this free open-source alternative called Open Sim . It lets you browse the directories of the apps on your simulator. It makes it super easy to locate the sqlite db in your Xamarin App and then you just need a sqlite viewer to open the actual database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.