我想从我的iPhone应用程序中删除图像. 
 
我使用下面的方法,将图像的名称作为参数传递.
我使用下面的方法,将图像的名称作为参数传递.
问题是图像不会被删除.
- (void)removeImage:(Nsstring*)fileName {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
    Nsstring *documentsDirectory = [paths objectAtIndex:0];
    Nsstring *fullPath = [documentsDirectory stringByAppendingPathComponent:
                      [Nsstring stringWithFormat:@"%@.png",fileName]];
    [fileManager removeItemAtPath: fullPath error:NULL];
    NSLog(@"image removed: %@",fullPath);
    Nsstring *appFolderPath = [[NSBundle mainBundle] resourcePath];    
    NSLog(@"Directory Contents:\n%@",[fileManager directoryContentsAtPath: appFolderPath]);
} 
 最后两行显示了我的app目录中的内容,我想要删除的图像仍然存在.我究竟做错了什么?
解决方法
 您正在尝试删除Documents目录中的文件.然后,您将阅读bundle资源目录的内容.这些目录不是同一个目录. 
  
 
        如果您正在尝试删除Documents目录中的文件,那么您最后应该在NSLog()中放置该目录.如果您尝试删除捆绑包中的文件,则无法执行此操作.应用程序包已签名且无法修改.