I have been tasked with cleaning up someone else's Objective-C (iOS) code. My Objective-C chops are a bit rusty, so I am hoping you all can verify something for me.
The person who coded the project that I am tasked with cleaning up, seems to be handling a nil object check multiple different ways. I just want to be clear that all of the following actually behave the same way, and there is not some little nuance I am missing.
Method 1
if ([completeProdDict objectForKey:@"specialInstructions"])// does object for key exist
Method 2
if (nil !=[completeProdDict objectForKey:@"specialInstructions"])// does object for key exist
Method 3
if ([completeProdDict objectForKey:@"specialInstructions"] !=nil)// does object for key exist
Is my assumption that all of these behave the same way, correct?
// does object for key exist
couldn't Method 1 just be used?