I want to check result of json is null or not ..I used this code
- (NSString *)likesCount {
if ([facebook valueForKey:@\"likes\"] == [NSNull null]) {
Try this code
- (NSString *)likesCount {
if ([[facebook valueForKey:@"likes"] isEqualToString:@"(null)"] || [facebook valueForKey:@"likes"] == nil) {
return @"";
}
else {
return [facebook valueForKey:@"likes"];
}
}
Use this category on NSDictionary, code will be much cleaner:
TouchJSON, dealing with NSNull