StringByAppendingPathComponent:masterName] NSString *masterPathFromApp = resourcePath] NSString *databasePathFromApp = resourcePath] Get the path to the database in the application package If not then proceed to copy the database from the application to If the database already exists then return without doing anything Check if the database has already been created in the users of the database and to copy it over if required Create a FileManager object, we will use this to check the status Check if the SQL database has already been saved to the users * And finally, I added another function belowĪpplicationDidFinishLaunching called checkAndCreateDatabase, as Execute the "checkAndCreateDatabase" function StringByAppendingPathComponent:databaseName] MasterPath = [libraryDir the directory path for the 0000000000000001.db fileĭatabasePath = [libraryDir the full path for the Databases.db file the directory path for the Databases.db file (NSLibraryDirectory, NSUserDomainMask, YES) ![]() NSArray *libraryPaths = NSSearchPathForDirectoriesInDomains Copy over the database if it doesn't existĭatabaseName = Get the path to the Library directory and append the databaseName * I added the following to the GlassAppDelegate.m file INSIDE the INSIDE the GlassAppDelegate section (inside the ) * I then modified the GlassAppDelegate.h file to include the following Resources folder of my project, which makes them included in the app * I copied both the "Databases.db" file (from the Databases folder),Īnd the "0000000000000001.db" file (from the file_0 folder) in to the Library/Application\ Support/iPhone\ Simulator/User/Applications//Library/WebKit/Databases/file_0/ * The iPhone simulator files live (by default) at /Users// * I built the SQLite database file in the iPhone simulator (it was The databaseįile itself, and the "Databases.db" file, which keeps track of the Objective C to install it in the proper location on the iPhone.Īctually, there are 2 files that need to be installed. Simulator, and copy it in to my Resources folder, and then modify the IĬould do it, but it took forever, and sometimes crashed on the phone,īut from that, I was able to take the database that was build for the ![]() Trying to build the database with Javascript was prohibitive. I was pounding my head against installing a big (120K rows) SQLiteĭatabase in an iPhone application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |