Guest User

Untitled

a guest
Jul 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. int result = sqlite3_open("/MyApp.db", &database);
  2.  
  3. if(result != SQLITE_OK)
  4. {
  5. sqlite3_close(database);
  6. NSLog(@"Failed to open DB");
  7. return;
  8. }
  9.  
  10. else {
  11. NSLog(@"Opened DB");
  12. }
  13.  
  14. sqlite3 *contactDB;
  15.  
  16. if (!success)
  17.  
  18. NSAssert1(0, @"Failed to create database file with message '%@'.", [error localizedDescription]);
  19.  
  20. }
  21.  
  22. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
  23.  
  24. NSString *documentsDir = [paths objectAtIndex:0];
  25.  
  26. return [documentsDir stringByAppendingPathComponent:@"YOURDATABASENAME.sqlite"];
  27.  
  28. NSString *dirPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
  29. NSUserDomainMask,
  30. YES) objectAtIndex:0];
  31. NSString *dbFile = [dirPath stringByAppendingPathComponent:@"sqlite.db"];
Add Comment
Please, Sign In to add comment