Delete specified file from document directory

前端 未结 10 946
礼貌的吻别
礼貌的吻别 2020-12-02 06:18

I want to delete an image from my app document directory. Code I have written to delete image is:

 -(void)removeImage:(NSString *)fileName
{
    fileManag         


        
10条回答
  •  粉色の甜心
    2020-12-02 06:45

    Instead of having the error set to NULL, have it set to

    NSError *error;
    [fileManager removeItemAtPath:filePath error:&error];
    if (error){
    NSLog(@"%@", error);
    }
    

    this will tell you if it's actually deleting the file

提交回复
热议问题