Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Below there are 2 function</p> <ol> <li>First one to copy you database if it is not in your app during installing in ur emulator.</li> </ol> <p>2.second function to get the path of database.</p> <p>these 2 functions must call in <code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions</code> delegate function in <code>yourAppdelegate.m</code> so that your database will copy it into your application folder of the emulator if it not present there.</p> <p>Don't forget to add </p> <pre><code>NSString *databasePath; sqlite3 *contactDB; </code></pre> <p>in <code>yourAppdelegate.h</code></p> <pre><code>- (void) copyDatabaseIfNeeded { NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSString *dbPath = [PropertyUploaderAppDelegate getDBPath]; BOOL success = [fileManager fileExistsAtPath:dbPath]; if(!success) { NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"YOURDATABASENAME.sqlite"]; success = [fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&amp;error]; if (!success) NSAssert1(0, @"Failed to create database file with message '%@'.", [error localizedDescription]); } } +(NSString *) getDBPath { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex:0]; return [documentsDir stringByAppendingPathComponent:@"YOURDATABASENAME.sqlite"]; } </code></pre> <p>After these process check it in <code>/Library/Application Support/iPhone Simulator/4.1/Applications/&lt;yourAppfolder&gt;/Documents</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload