成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

解決Sqlite在IOS應(yīng)用中使用方法案例實(shí)現(xiàn)

移動開發(fā) iOS
Sqlite在IOS應(yīng)用中如何應(yīng)用是本文要介紹的內(nèi)容,主要是來了解IOS應(yīng)用中sqlite的使用方法,具體內(nèi)容的實(shí)現(xiàn),來看本文詳細(xì)代碼。

SqliteIOS應(yīng)用中如何應(yīng)用是本文要介紹的內(nèi)容,主要是來了解IOS應(yīng)用sqlite的使用方法,sqlite數(shù)據(jù)庫初始化,復(fù)制到用戶目錄,并判斷是否數(shù)據(jù)庫已經(jīng)存在,或者復(fù)制是否成功!

在AppDelegate.m中輸入以下代碼,以便復(fù)制預(yù)置數(shù)據(jù)庫到指定doucment目錄

  1. - (BOOL) initializeDb {  
  2. NSLog (@"initializeDB");  
  3. // look to see if DB is in known location (~/Documents/$DATABASE_FILE_NAME)  
  4. //START:code.DatabaseShoppingList.findDocumentsDirectory  
  5.  
  6. NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);  
  7.  
  8. NSString *documentFolderPath = [searchPaths objectAtIndex: 0];  
  9. //查看文件目錄  
  10. NSLog(@"%@",documentFolderPath);  
  11. dbFilePath = [documentFolderPath stringByAppendingPathComponent:@"shopping.db"];  
  12. //END:code.DatabaseShoppingList.findDocumentsDirectory  
  13. [dbFilePath retain];  
  14. //START:code.DatabaseShoppingList.copyDatabaseFileToDocuments  
  15. if (! [[NSFileManager defaultManager] fileExistsAtPath: dbFilePath]) {  
  16. // didn't find db, need to copy  
  17. NSString *backupDbPath = [[NSBundle mainBundle] pathForResource:@"shopping" ofType:@"db"];  
  18. if (backupDbPath == nil) {  
  19. // couldn't find backup db to copy, bail  
  20. return NO;  
  21. } else {  
  22. BOOL copiedBackupDb = [[NSFileManager defaultManager] copyItemAtPath:backupDbPath toPath:dbFilePath error:nil];  
  23. if (! copiedBackupDb) {  
  24. // copying backup db failed, bail  
  25. return NO;  
  26. }  
  27. }  
  28. }  
  29. return YES;  
  30. //END:code.DatabaseShoppingList.copyDatabaseFileToDocuments  
  31. NSLog (@"bottom of initializeDb");  
  32. }  
  33. - (void)applicationDidFinishLaunching:(UIApplication *)application {  
  34. // copy the database from the bundle if necessary  
  35. if (! [self initializeDb]) {  
  36. // TODO: alert the user!  
  37. NSLog (@"couldn't init db");  
  38. return;  
  39. }  
  40.     // Add the tab bar controller's current view as a subview of the window  
  41.     [window addSubview:tabBarController.view];  

小結(jié):解決SqliteIOS應(yīng)用中使用方法案例實(shí)現(xiàn)的內(nèi)容介紹完了,希望通過本文能對你有所幫助!

責(zé)任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2012-03-06 10:17:45

iOS SQLite3iOSSQLite3

2010-11-19 09:56:38

SQLiteAndroid

2011-05-17 16:20:46

C++

2011-03-30 10:41:11

C++數(shù)據(jù)庫

2023-01-28 17:41:07

Java代碼

2012-12-27 13:04:17

Android開發(fā)SQLite數(shù)據(jù)庫

2011-09-02 19:12:59

IOS應(yīng)用Sqlite數(shù)據(jù)庫

2024-09-11 08:00:00

Java優(yōu)于反射開發(fā)

2012-02-13 14:22:22

MonoTouchiOS應(yīng)用Visual Stud

2012-02-13 14:10:11

MonoTouchiOS應(yīng)用Visual Stud

2011-07-29 11:10:56

IOS SimpleLogg 日志

2021-02-25 11:19:37

谷歌Android開發(fā)者

2011-08-19 10:01:09

iPhone應(yīng)用SqliteUITableView

2013-07-25 14:12:53

iOS開發(fā)學(xué)習(xí)UITableView

2011-08-10 16:08:02

iPhoneProtocol協(xié)議

2023-12-22 09:11:45

AndroidNFC移動開發(fā)

2018-06-20 10:34:56

堆棧iOSswift

2011-08-31 16:30:19

Lua多線程

2011-08-05 14:58:58

iPhone CoreAnimat 動畫

2011-08-03 17:27:40

iPhone UIScrollVi
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 中文字幕一区二区三区四区五区 | 在线不卡视频 | 91麻豆精品国产91久久久资源速度 | 国产午夜精品一区二区三区嫩草 | 亚洲一区二区中文字幕 | 色播99 | 99在线免费观看视频 | 亚洲综合在线一区二区 | caoporn视频在线 | 久色视频在线 | 国产激情偷乱视频一区二区三区 | re久久 | 久久国产高清视频 | 久热久热| 国产精品久久久av | 国产乱码精品一区二区三区中文 | 欧美一区二区三区视频 | 欧美日韩18 | 久久1区| 日韩精品免费在线观看 | 亚洲三级在线观看 | 亚洲日韩中文字幕一区 | 99久久久国产精品免费消防器 | 国产精品久久久久久福利一牛影视 | 久久久久久网站 | 不卡在线视频 | 亚洲日韩中文字幕一区 | 午夜精品久久久久久久久久久久久 | 久久久久国产精品一区二区 | 国产精品观看 | 亚洲v日韩v综合v精品v | 成人在线不卡 | 自拍偷拍亚洲视频 | 欧美日韩国产在线观看 | 91久久久精品国产一区二区蜜臀 | 久久免费观看一级毛片 | 国产精品一区二区久久 | 精品成人av | 天天草天天射 | 两性午夜视频 | 成av人电影在线 |