-indexOfObject: returns an integer of type NSUInteger , not an object reference. Therefore, you should not use the debug command po (print object), but p .
It returns 0 , not nil , which means that it found the object in the first position of the array. If it does not find the object, -indexOfObject: will return NSNotFound .
The lowest index whose corresponding array value is aObject. If none of the objects in the array is equal to anObject, returns NSNotFound.
Ammin negm-awad
source share