When has happen to the release method? I always release a memory allocation when I am done with it and now it seems that the method has been deprecated. Or maybe it does not work for some objects?
Anyway, this is what I did:
Customer *aCustomer = [[Customer alloc] init];
...
[aCustomer release];
and I get an error there... Anyone care to explain why I get an error now that I release my memory? The error message is:
'release' in unavailable: not available in automatic reference counting mode ARC forbids explicit message send of 'release'
To manage memory by yourself go to "build settings" and set the flag "Objective-C automatic reference counting" to "No" (it's under "Apple LLVM compiler")
Automatic Reference Counting (ARC) for Objective-C makes memory management the job of the compiler. By enabling ARC with the new Apple LLVM compiler, you will never need to type retain or release again, dramatically simplifying the development process, while reducing crashes and memory leaks. The compiler has a complete understanding of your objects, and releases each object the instant it is no longer used, so apps run as fast as ever, with predictable, smooth performance.
Consider using ARC (Automatic Retain Counting) for your project. There is a refactoring that will convert a current project.
来源:https://stackoverflow.com/questions/9061162/release-method-deprecated