iOS Having trouble opening SQLite DB

I keep getting the error not found. Where exactly should it be located? I have tried setting copyfile to all the targets. This code worked on an earlier version built with the first Xojo iOS version.

data is subfolder in the apps directory.

Dim f As FolderItem

f = SpecialFolder.Documents.Child("data/ASPEdata.sqlite")

App.dbASPEData = New iOSSQLiteDatabase
App.dbASPEData.DatabaseFile = f
if Not App.dbASPEData.Connect then
  Return False
end

Anybody point out what I’m doing wrong?

SpecialFolder.Documents is the Documents folder of the app. There is no Data folder in there.

try f = SpecialFolder.Documents.Child("data").Child("ASPEdata.sqlite") ?

I put the DBs in a data folder. In the copy files I don’t see a Documents folder option.

How do I get the files into the Documents folder?

Instructions

So there is no Documents Folder until you create one by copying the db from the resource folder, then it is writable.

So Documents is where SqlLite files should go?

Its the logical place for them. You could then also create a data folder within the documents folder. If you turn on filesharing in itunes you can then access the files from your desktop when you have the iphone/ipad plugged into it.

@Steve Koger

OK I now have my db in Resources and app.open copies it to Documents. The app seems to run fine, now though I wanted to look at the values in the table and I can’t find the table to make sure everything is written correctly? Where can I find the DB?

Are you trying to find the db from your desktop or from your application?

After I run the iOS app, I want to look at the table it saved data to. So it would be the ios Sqlite.

You would either have to have written code that can show you whats in that table as part of your application. Or using the instructions I linked to previously follow the instructions on how to copy a file to your ipad with itunes(Second part of instructions on that linked page). You could copy the sqlite database back to your desktop and access it with a dbtool like navicat.

I’m not putting it on an iOS device, just running in the debugger. So where when the app is running in the debugger is the database?

break as soon you create the folderitem
copy from the debugger the path and use it in the finder (go to folder)

It’s in the bowels of the the system as determined by the iOS Simulator. Your best bet is to display the path to the DB somewhere in your app so you can see the full path.

On my system, I got this path for an iOS app’s Documents folder:

/Users/lefebvre/Library/Developer/CoreSimulator/Devices/AE8FAB08-94B1-4A9B-8FAA-ABB9EA9CEC1C/data/Containers/Data/Application/7FA599F3-1AD9-4C36-9BC2-CB9F3D7FCBA9/Documents

Thanks guys! I’ll try it.

Aw yes I see Paul told you where to search for it :slight_smile: Takes a bit of patience but you will find it.

@Steve Koger
@Paul Lefebvre

Anybody wanna take a crack at: https://forum.xojo.com/49384-why-does-compilation-keep-failing

I name my iOS databases something unique and then use Find Any File (by Thomas Tempelmann) to find them in the simulator. As far as I know there’s no magic solution to finding the database on the Mac side.

I usually browse to the Applications folder and then do a search for the file from Applications. The folder in Devices usually will have a modification date of when you last ran the simulator. So its easy to spot. The folder below applications often is not easily identifiable. So I search from there down with the search box.

Btw lefebvre would be replaced by the user you are currently logged in as.

/Users/lefebvre/Library/Developer/CoreSimulator/Devices/AE8FAB08-94B1-4A9B-8FAA-ABB9EA9CEC1C/data/Containers/Data/Application/