Search code examples
objective-ccocoamethodsnsfilemanager

What does the method release from the class NSfileManager do?


The method release from the object fileManager is executed below. That's all I know at the moment. I tried searching for the meaning of the method release, but I couldn't find it.

I searched on StackOverflow:

  • body:"[filemanager release];"
  • filemanager release
  • NSfilemanager release

I searched on Google:

  • fileManager release method
  • NSfilemanager release method

I also tried finding the method on developer.apple.com. I saw alot of info about the NSfileManager class, but I didn't see the release method of it. I am new to Objective-C.

[fileManager release];

Solution

  • It is inherited from NSObject. it reduces reference count on an object by one. You can make use of it only when Automatic Reference Counting is disabled. But it should always be enabled. So enable ARC and forget about release

    And read this : Cocoa Memory Management

    And this: Transitioning to ARC

    You may see an error like this, I believe if you're using Xcode v.5.0 or above.

    enter image description here