Skip to content

Instantly share code, notes, and snippets.

@jpweber
Created July 21, 2013 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpweber/6047175 to your computer and use it in GitHub Desktop.
Save jpweber/6047175 to your computer and use it in GitHub Desktop.
ultimate check for nil from wil shipley
if ([pushedCompleteTransaction.manuallySetTransactionDate isKindOfClass:[NSNull class]]
|| ([pushedCompleteTransaction.manuallySetTransactionDate respondsToSelector:@selector(length)]
&& ![pushedCompleteTransaction.manuallySetTransactionDate respondsToSelector:@selector(count)]
&& [(NSData *)pushedCompleteTransaction.manuallySetTransactionDate length] == 0)
|| ([pushedCompleteTransaction.manuallySetTransactionDate respondsToSelector:@selector(count)]
)){
formattedDate = [dateFormatterIn dateFromString:pushedTransaction.timeStamp];
NSLog(@"using original timestamp");
NSLog(@"using %@ as date", formattedDate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment