我收到filemanager對象引用計數的錯誤遞減。引用計數遞減不正確
-(void) checkDb{
BOOL success;
// Create a FileManager object, we will use this to check the status of the database and to copy it over if required
NSFileManager *fileManager = [NSFileManager defaultManager];
// Check if the database has already been created in the users filesystem
success = [fileManager fileExistsAtPath:dbPath];
if (success)
{
//we found the file, we need to check version
sqlite3 *db;
//NSLog(@"Current Databasepath: %@",dbPath);
// Open the current db (found in the user's filessytem)
if(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK) {
const char *sql = "select dbversion from settings";
sqlite3_stmt *rs;
if(sqlite3_prepare_v2(db, sql, -1, &rs, NULL) == SQLITE_OK) {
if (sqlite3_step(rs) == SQLITE_ROW) {
//not eof
int curDbVersion=sqlite3_column_int(rs,0);
if (curDbVersion>=minDbVersion){
//good dbversion, no need to copy from resources
return;
}
}
}
sqlite3_finalize(rs);
}
sqlite3_close(db);
}
//we reached this section which means:
//either database was not found, or invalid db version
//so, we need to copy it from the resources directory (or maybe download it from internet?)
// Get the path to the database in the application package
NSString *dbPathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:dbName];
// Copy the database from the package to the users filesystem
[fileManager copyItemAtPath:dbPathFromApp toPath:dbPath error:nil];
[fileManager release];
}
的程序運行完美,但是當我分析一下,我得到一個警告。
這裏的警告的截圖是我得到:
的東西可能我錯過任何提示?
非常感謝,現在我明白了..我自2周以來一直進入ios開發..並挖掘它..乾杯.. – deebee 2011-06-05 13:49:38