Code: Select all
if the platform is "iphone" then
put specialFolderPath("engine") & "/playtime.sqlite" into engineFilePath
put specialFolderPath("documents") & "/playtime.sqlite" into tDatabasePath
if there is a file engineFilePath then
if there is a file tDatabasePath then
// do nothing, database already exists in documents folder
answer information "Nothing to do, all setup"
else
put URL ("binfile:" & engineFilePath) into URL ("binfile:" & tDatabasePath)
answer information "Copy DB Structure " & the platform
end if
end if
end if
// connect to DB
answer "connecting to DB"
databaseConnect
answer information "DB Connect " & the platform
...
...
command databaseConnect
## The database must be in a writeable location
if the platform is "iphone" then
put specialFolderPath("documents") & "/playtime.sqlite" into gPlaytimeDBPath
else
put specialFolderPath("home") & "/Games/PlayTimer/playtime.sqlite" into gPlaytimeDBPath
end if
answer "Path is " & gPlaytimeDBPath
## Open a connection to the database
## If the database does not already exist it will be created
try
put revOpenDatabase("sqlite", gPlaytimeDBPath) into gPlaytimeDBID
put result() into tResult
answer "open db result is " & tResult
catch theError
answer info "Problem Opening Database: " & gPlaytimeDBPath & " " & theError
put 0 into gPlaytimeDBID
exit databaseConnect
end try
if gPlaytimeDBID is not an integer then
asnwer "DB Connection failure " & gPlaytimeDBID
else
answer "Connection details are " & result() & " - " & gPlaytimeDBPath & ", " & gPlaytimeDBID
end if
//put gPlaytimeDBPath & ", " & gPlaytimeDBID into field "Status"
//put result() & return before field "Status"
end databaseConnect
I am using LiveCode 7.0.4 Build 10030 and xCode Version 6.3 (6D570) and IOS 8.2. The app is being testing for iPhone and iPad.
I am almost at the stage of writing my own file handling using the LiveCode file open, read, write and update as I find the app launching issue unreliable for a commercial environment and I certainly do not want to revert to objective C and java coding for the IOS and Android apps.
Is there a setting that I am missing or something else?
Looking forward to resolving this issue so I can move forward with the completion of my app.
Many Thanks,
Tony C.