如何使用NSFileManager删除目录及其内容 [英] How to remove a directory and its contents using NSFileManager

查看:135
本文介绍了如何使用NSFileManager删除目录及其内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Objective C的新手。我创建了一些包含iPhone应用程序pdf文件的目录。如何使用NSFileManager删除目录及其内容?

New to Objective C. I have created a few directories which contain pdf files for an iPhone app. How can I delete a directory and its contents using NSFileManager?

我是否需要首先循环并删除内容?我们非常感谢任何代码示例。

Do I need to loop through and remove the contents first? Any code samples would be much appreciated.

提前致谢。

推荐答案

首先,通过Apple的 NSFileManager 文档查看iPhone是明智的: NSFileManager类参考。其次,查看 NSFileManager -removeItemAtPath:error:方法及其文档。这就是你要找的东西。

To start off, it would be wise to look through Apple's NSFileManager documentation for the iPhone: NSFileManager Class Reference. Second, look at NSFileManager's -removeItemAtPath:error: method and its documentation. That's what you're looking for.

这篇关于如何使用NSFileManager删除目录及其内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆