Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing Core Data data from your app on a device

I am building an app but testing it on my iPhone. The app is plugged into my computer and running from XCode. Is there anyway to see the data in Core Data that the app has generated? I see all the posts about the simulator and the files generated. I am trying to use DB Browser too.

like image 796
cdub Avatar asked Nov 19 '17 08:11

cdub


People also ask

What is coredata in iOS?

Core Data is a popular choice for implementing data persistence in iOS and OS X applications. Usually, CoreData utilizes an embedded SQLite database. Since iOS 8.3, it’s impossible to access arbitrary data in an application’s sandbox.

How do I use core data?

Use Core Data to save your application’s permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

How to create a single view app with core data in iOS?

The first step is to create a new project based on the Single View App template. Next, name the project, select your team name, and select “Use Core Data” and “Use CloudKit” checkboxes. Xcode generates some code in the AppDelegate.swift file to initialize the Core Data stack with this new class since iOS 13: NSPersistentCloudKitContainer.

How to encrypt coredata in iOS apps?

With data being shifted to devices, we need a way to ensure encryption of data stored in db files. One of the best ways of encrypting CoreData is by using SQLCipher through Encrypted-Core-Data. I found Encrypted-CoreData-Store best and easiest to implement in an iOS Project.


1 Answers

Step1:

Plug your device and open Devices and Simulators:

enter image description here

Step 2:

Select your app from installed Apps:

enter image description here

Step 3:

Press the settings icon and download container

enter image description here

Step 4:

Select the downloaded .xcappdata and show package contents:

enter image description here

Step 5:

Find the .sqlite file inside and open it using any sqlite reader like DB Browser

enter image description here

like image 167
Puneet Sharma Avatar answered Sep 25 '22 23:09

Puneet Sharma