こんにちは、新しい iPhone プログラマーです。
sqlite データベースに接続しようとしていますが、問題があります。sqlite ライブラリがあり、サポート ファイル フォルダーにデータベース ファイルがあります。シミュレーターをロードしても接続しません。
(void)viewDidLoad
{
[super viewDidLoad];
NSString *docsDir;
NSArray *dirPaths;
//Get the documents directory
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
docsDir = [dirPaths objectAtIndex:0];
//Builds the path to the database file
databasePath = [[NSString alloc]
initWithString:[docsDir stringByAppendingPathComponent:@"PetrolWatch.sqlite"]];
NSFileManager *fileMgr = [NSFileManager defaultManager];
if([fileMgr fileExistsAtPath:databasePath]== YES)
{
lblStatus.text = @"Path Exists";
}
else
{
lblStatus.text = @"Failed to open db";
}
}
前もって感謝します