// 文件存放目录
NSString *pngDir = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"];
NSFileManager *fileMgr =[NSFileManager defaultManager];
NSString *FileDir =[NSString stringWithFormat:@"%@/AnnexFiles", pngDir];
NSError *err;
[fileMgrcreateDirectoryAtPath:FileDirwithIntermediateDirectories:YESattributes:nil error:&err];
NSString *FileFullPath =[FileDir stringByAppendingPathComponent:[DBTopicAnnexDataName]];
BOOL bRet = [fileMgrfileExistsAtPath:FileFullPath];
if (bRet) {
//
NSError *err;
[fileMgr removeItemAtPath:FileFullPath error:&err];
}
或者
// 清除本地配置数据
NSArray *paths= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory =[paths objectAtIndex:0];
NSFileManager*fileMgr = [NSFileManagerdefaultManager];
NSString *MapLayerDataPath =[documentsDirectory stringByAppendingPathComponent:@"DBMapLayerData.xml"];
BOOL bRet = [fileMgrfileExistsAtPath:MapLayerDataPath];
if (bRet) {
//
NSError *err;
[fileMgr removeItemAtPath:MapLayerDataPatherror:&err];
}