What is the correct way to check the contents of standardUserDefaults ?
If I print out what is stored in a key i get:
NSLog(@"logged_in_status : %@", [standardUserDefaults stringForKey:@"logged_in_status"]);
Output: logged_in_status : (null)
So it seems to be NSNull.
So I will add a check for that as follows:
if ([[standardUserDefaults objectForKey:@"logged_in_status"] isKindOfClass:[NSNull class]])
{
NSLog(@"YES");
}
else
{
NSLog(@"NO");
}
Output: NO
Why does this not resolve to the YES? Isn't it an NSNull?
I've been looking at this for a long time and can't see where the error is. Could anybody kindly explain where I've gone wrong on this?
Thanks, Code
Aucun commentaire:
Enregistrer un commentaire