Nil can only be applied in the ID type, that is, the pointer to the object in Java and C ++. Null is used as a non-object pointer.
See the following example:
-(Void)Observevalueforkeypath Nsstring *)Keypath ofobject ID)Object
Change:(Nsdictionary *)Change Context:(Void *)Context
The context parameter is a null pointer type and a C-type pointer. Therefore, it is defined as null. The NULL pointer type is sometimes declared
(Void *) 0, rather than ID-type nil.
Original article:
"Nil" shocould only be used in place of an "ID", what we Java and C ++
Programmers wocould think of as a pointer to an object. Use NULL
Non-object pointers.
Look at the Declaration of that method:
-(Void)Observevalueforkeypath:(Nsstring *)Keypath ofobject:(ID)Object
Change:(Nsdictionary *)Change Context:(Void *)Context
Context is a "Void *" (ie a C-style pointer), so you 'd definitely use
NULL (which is sometimes declared as "(void *) 0") rather than Nil
(Which is of type "ID ").