Search code examples
ioscocoa-touchplistnsfilemanager

"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'

Is this because I am not using NSObject?

in .h

:UITableViewController<UIApplicationDelegate,UIAlertViewDelegate>

How can I fix this error or delete the plist files?


Solution

  • The NSFileManager docs don't list a removeFileAtPath:error: method, which is why you're getting that error. What you need is the removeItemAtPath:error: method (item, not file).

    To answer your question about NSObject, if you head to the UITableViewController docs, you can see the class's inheritance tree:

    Inherits from UIViewController : UIResponder : NSObject

    This shows that UITableViewController inherits from UIViewController, which inherits from UIResponder, which inherits from NSObject. So you are in essence using NSObject, though subclassed by three generations. Note that this is not related to the NSFileManager error.