10
Видаліть вказаний файл із каталогу документів
Я хочу видалити зображення зі свого каталогу документів програми. Код, який я написав для видалення зображення: -(void)removeImage:(NSString *)fileName { fileManager = [NSFileManager defaultManager]; paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); documentsPath = [paths objectAtIndex:0]; filePath = [documentsPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", fileName]]; [fileManager removeItemAtPath:filePath error:NULL]; UIAlertView *removeSuccessFulAlert=[[UIAlertView alloc]initWithTitle:@"Congratulation:" message:@"Successfully removed" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil]; [removeSuccessFulAlert …