简体   繁体   English

iOS中的“ NSFileManager没有可见的界面”

[英]“No Visible Interface For NSFileManager”, iOS

I want to delete my two plist after I am done with them. 处理完两个列表后,我想删除它们。 I am trying this using this line: 我正在尝试使用此行:

[[NSFileManager defaultManager] removeFileAtPath:path error:NULL];

This give me error: 这给我错误:

No visible @interface for 'NSFileManager' declares the selector 'removeFileAtPath:error' 'NSFileManager'的可见@interface没有声明选择器'removeFileAtPath:error'

Is this because I am not using NSObject? 这是因为我没有使用NSObject吗?

in .h 在.h中

:UITableViewController<UIApplicationDelegate,UIAlertViewDelegate>

How can I fix this error or delete the plist files? 如何解决此错误或删除plist文件?

The NSFileManager docs don't list a removeFileAtPath:error: method, which is why you're getting that error. NSFileManager文档未列出removeFileAtPath:error:方法,这就是为什么您会收到该错误的原因。 What you need is the removeItemAtPath:error: method ( item , not file ). 您需要的是removeItemAtPath:error:方法( item ,不是file )。

To answer your question about NSObject, if you head to the UITableViewController docs , you can see the class's inheritance tree: 要回答有关NSObject的问题,如果您前往UITableViewController docs ,则可以看到该类的继承树:

Inherits from UIViewController : UIResponder : NSObject 继承自 UIViewController:UIResponder:NSObject

This shows that UITableViewController inherits from UIViewController, which inherits from UIResponder, which inherits from NSObject. 这表明UITableViewController继承自UIViewController,UIViewController继承自UIResponder,NSResponder继承自NSObject。 So you are in essence using NSObject, though subclassed by three generations. 因此,您实际上是在使用NSObject,尽管它由三代继承。 Note that this is not related to the NSFileManager error. 请注意,这与NSFileManager错误无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM