存:
NSFileManager*fileManager=[NSFileManagerdefaultManager];
NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
//文件名
NSString*uniquePath=[[pathsobjectAtIndex:0]stringByAppendingPathComponent:@"pin.png"];
BOOLblHave=[[NSFileManagerdefaultManager]fileExistsAtPath:uniquePath];
if(!blHave){
NSLog(@"nohave");
return;
}else{
NSLog(@"have");
BOOLblDele=[fileManagerremoveItemAtPath:uniquePatherror:nil];
if(blDele){
NSLog(@"delesuccess");
}else{
NSLog(@"delefail");
}
}
NSFileManager* fileManager=[NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
//文件名
NSString *uniquePath=[[paths objectAtIndex:0] stringByAppendingPathComponent:@"pin.png"];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:uniquePath];
if (!blHave) {
NSLog(@"no have");
return ;
}else {
NSLog(@" have");
BOOL blDele= [fileManager removeItemAtPath:uniquePath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
}