Find SQLite File by iPhone Simulator for iOS 8 from Xcode 6 under OS X
Home page for the video series called SwiftNow CoreData
You’re using Xcode 6 under OS X to create an iPhone app for iOS 8 using Core Data. Your code is working using a number of Swift statements similar to those mentioned on this page. Everything runs fine. There are no compilation errors, no run-time errors whatsoever. Now you want to take a look at the SQLite data generated and used by your app. The tasks on this page are what you need to do.
Task 1 Install Firefox
- If you do not have Firefox on your Mac computer, download and install it.
Task 2 Install SQLite Manager as an Add-on to Firefox
- Bring up Firefox
- Select the menu { Firefox > Tools > SQLite Manager }
- If that menu is not there, download and install the Firefox Add-on SQLite Manager.
Task 3 Unhide Library Folder
- Bring up Finder app
- Press shift-command-H to go Home
- Do the following only if you do not see the folder Library there.
- Skip the following if you can find the folder, file:///Users/yourMacLoginName/Library/Developer/CoreSimulator/Devices
- Bring up the Terminal app
- Execute the following command on the Terminal: chflags nohidden ~/Library
- The folder Library should now appear at your home folder.
Task 4 Identify the SQLite File Path
- Open the source code file, AppDelegate.swift.
- Search for the function, applicationDocumentsDirectory.
- Insert the following right before the return statement: println(“urls”)
- Run your app
- Save data via Core Data from your app
- View the Debug area and see an SQLite file path similar to the following: [file:///Users/yourMacLoginName/Library/Developer/CoreSimulator/Devices/0BB4470A-D080-435B-B274-279724029EF8/data/Containers/Data/Application/8E74751C-2B96-470C-857A-AF3A6ABE0FF3/Documents/]
Task 5 Copy the SQLite File to Your Desktop
- Copy the SQLite file from the above path to your desktop
Task 6 Open the Database File Using SQLite Manager on Firefox
- Bring up Firefox
- Select the menu { Firefox > Tools > SQLite Manager }
- Open the SQLite file on your desktop
- Expand the folder Table on the navigator panel on the left.
- Click on the data table of interest
- Select the button Browse & Search near the top of the app
- Select one of the records in your data table
- Press the Edit button
- Now you can make changes to your data.
Pingback: Swift Demo 3 Core Data | Swift Now