I'm trying to save data to an SQLite database on one card, then on another card retrieve this information and display it in reverse entry order.
Everything is working great on the desktop, but on iOS I get one of two problems:
1) If I attempt to create the database in the specialfolderpath("documents") directory on first run the app cannot find the database.
2) If I attempt to load a database that has been copied into the app at build I get an error for trying to write to a read only database.
If someone could take a look and suggest a solution... I'm sorry my code has so many commented out portions, but I'm pretty new to this and I've been trying different things all evening.
Really frustrating that this works on desktop perfectly then bugs as soon as it hits the simulator or an iphone.
Thanks.
SQLite on iOS database issues
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
SQLite on iOS database issues
- Attachments
-
- database.livecode.zip
- The code that is not working right... sorry for the sloppy comments, I've been working on this all evening trying different approaches.
- (4.27 KiB) Downloaded 309 times
Check out my LiveCode program, WriteSpire, on the App Store!
Re: SQLite on iOS database issues
Hey Observ3
I know first hand how frustrating this can be. You might try this code, it isn't SQLite but it does save a stack effectively and it's simple.
Put this in a button on the first stack...
Just get rid of the words "Level Select" and use the name of the second stack. You do need two stacks for this, the first one that pops up won't be saved but it will save the next stack that opens.
Put this into the stack script of the other stack...
I hope this helps. Let me know if you get confused.
Danny
I know first hand how frustrating this can be. You might try this code, it isn't SQLite but it does save a stack effectively and it's simple.
Put this in a button on the first stack...
Code: Select all
on mouseUp
open stack "Level Select"
if the environment is "mobile" then
put (specialFolderPath("Documents") & "/Level Select.livecode") into tPathToDatabase
put (specialFolderPath("engine") & "/Level Select.livecode") into tPathToStartLoc
try
if not (there is a file tPathToDatabase) then
put url ("binfile:" & tPathToStartLoc) into temp
put temp into url ("binfile:" & specialfolderpath("Documents") & "/Level Select.livecode")
wait 5 milliseconds with messages
end if
catch pErr
put pErr into field 1
end try
try
go stack tPathToDatabase
catch pErr
put pErr into field 1
end try
end if
end mouseUp
Put this into the stack script of the other stack...
Code: Select all
on shutDown
save this stack
end shutDown
Danny
Re: SQLite on iOS database issues
Thanks Danny. I don't think that will work for this application, but I will certainly add it to my bag of tricks.
Still hoping someone out there has figured out the black magic of mobile SQL...
Still hoping someone out there has figured out the black magic of mobile SQL...
Check out my LiveCode program, WriteSpire, on the App Store!