invalid database install path error when running application on iPhone
Hi guys,
I need some help please.
Is there any reason to why I'm getting the following error when I install my app on my iPhone, everything seems to be working fine on the simulator but on the actual device I receive the following error.
Basically it's related to an sqllite database I've created on the resources folder under a new folder called databases, just wondering if I need to replace this file any where else or what will be the solution. However the error message I'm receiving is the following:
invalid databse install path.
/var/mobile/Applications/FE1 -
D6A)f-09E1-497C-B150-
896DDD6B431C/test.app/databases/test in -
[TiDatabaseProxy
install:name:]
(TiDatabaseProxy.m:87) at
app.js (line 1)
2 Answers
-
I figured out the solution to my issue, thanks for your help guys :) just joking…
Basically the following function file name is case sensitive so make sure your database is called 'testDatabase.sql' and not 'testdatabase.sql' otherwise you will get the same error I've received.
var db = Titanium.Database.install('databases/testDatabase','test);
Good luck and happy coding :)
-
Major headache, but I found the solution. Use database.open() instead of install() except when you are truly opening a particular database under a particular name for the very first time.
In my app, I used Ti.Database.install() both for installing and opening the database. Even for opening the database when I could be absolutely sure that nothing changed since the last time the user opened the app.
This is consistent with the docs, which state that "If the destination file already exists, [ install ] behaves as open."
However, install does not behave as open. Not in my case, on iOS device, with Ti SDK 3.1.0. If you've already installed a particular database file and given it a particular name, then you cannot do install() with that file and that name. This will cause the "invalid database install path" error.
Although of course, the very first time you use install on a file, this will work just fine, since at that point it actually installs.
Strangely, using install() for opening an existing database with an existing memory name does work in some other situations too. It may have to do with the file location. In my app, I have a mechanism for downloading updates for the database file, and giving those a versioned name so there will never be conflicts.
The downloaded db files are stored in a path starting with: Ti.Filesystem.applicationDataDirectory
Using install() any number of times on this filename is no problem, whether the db name variable is new or old.The pre-installed database that comes with the app is located in: Ti.Filesystem.resourcesDirectory
Using install() a second time with this filename and an existing db name causes the install path error.Hope this helps!