The use of ARC has undoubtedly greatly reduced the pressure on the programmer to manage memory. You don't have to write release/autorelease code anymore, you don't have to write the Dealloc method anymore. But that doesn't mean programmers don't need memory management. For example, you need to release an object in the Viewdidunload method in case you don't have memory to recycle when a memory warning occurs. Of course, the Arc managed object is released in a different way from MRC. For Arc managed objects, you have to use two types of release that arc-specific:
[Self setojbect:nil];
Or:
Self.object=nil;
Here, object is the name you want to release.
The two modes of release are essentially equivalent, and even many books claim that they are completely equivalent. For programmers with java/c++/c# development experience, the call to point syntax is clearly more cordial.
But I have to tell you that the two are not exactly equal. [Self Setobject:nil] is more secure in cases where object objects are not initialized (for nil).
If object is not initialized, the Self.object=nil call causes a "send message to the destroyed object" error and the program crashes. And [Selfsetobject:nil] is not at all.
Note: The ipad's memory management seems to be much broader, and some code that works on the ipad can cause memory management to fail on the IPhone.
This is because ARC adds an "Auto balance" code when synthesizing the access method of the Property object, which automatically detects the Alloc/release invocation of the object and balances it in an extremely intelligent way.
Therefore, for those accustomed to java/c++ language "." In the case of a programmer with rampant syntax, it should be possible to discard the prejudices of o-c and return to the "right" of the message invocation syntax.
Especially for the release of objects, be careful to use the [self setobject:nil] approach, instead of using the "." Grammar. Because, you can send a "message" to a nil object, but you cannot assign a value to a nil object.