First of all, the role of their two, nil is to put an object's pointer to empty, just cut off the pointer and in-memory objects, it does not have any effect on the release of memory, and release is really used for memory release, after release, the system will mark the Block memory is available (can be reassigned). So nil does not release memory, only release is really free memory.
The two use order, if there is no release on the direct nil, then although there is no error (release a null pointer is legal), but it is tantamount to creating a memory leak, because nil after the release has no effect, My previous lesson was to put nil before release, so leak has been reporting memory leaks.
Conversely, if you set nil after release, there will be no such problem, but someone will ask, release without setting nil, what will happen? In fact, the program may not error, but to know that the set nil is actually to prevent pointer confusion, because an object in the release, the allocated memory has been released, if you do not empty the pointer after release, the system again misused to this pointer, Then the program crashes (this is especially easy to do in the delay call function), and if it is released and the pointer is empty, it will not crash even if the subsequent program uses the pointer. So objective-c must release and nil when releasing memory.
The difference and usage of nil and release in Objective-c