I'm developing iOS App with FMDB(Database Library of using SQLite easily).
For creating and opening a database, I'm writing down the following code.
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *paths = [manager URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask];
NSURL *documentDirs = [paths lastObject];
NSURL *writableDBPath = [documentDirs URLByAppendingPathComponent:@"test.db"];
NSString *writableDBPathString = [writableDBPath path];
NSLog(@"DB path:%@",writableDBPathString);
FMDatabase *myDatabase = [FMDatabase databaseWithPath:writableDBPathString];
[myDatabase open];
After running my Xcode Simulator, the above "NSLog" shows the following message, so I guess I can get the collect path.
2014-07-14 02:42:18.296 ninethtest[2064:a0b] DB path:/Users/myname/Library/Application Support/iPhone Simulator/7.0/Applications/D71C7BC8-8F01-486F-81FA-E1Exxxxxxx/Documents/test.db
However, the following error message appears at "NSURL *writableDBPath = [documentDirs URLByAppendingPathComponent:@"test.db"];" and "[myDatabase open];" in the above code.
Thread1:EXC_BAD_ACCESS(code=2,address=0xbf7ffffc)
Could you tell me how to solve this problem?