#pragma mark ======== Null Checking for web services ===============
+(id)checkForNull:(id)value
{
NSString *valueString = [NSString stringWithFormat:@"%@",value];
id objectString = @"";
if (![valueString isEqualToString:@"(null)"] && ![valueString isEqualToString:@"<null>"] && valueString.length != 0)
return value;
return objectString;
}
EX
[localTrendsData setPhone_number:[self checkForNull:[currentLocalTrends valueForKey:@"phone_number"]]];
[localTrendsData setUser_id:[self checkForNull:[currentLocalTrends valueForKey:@"user_id"]]];
[localTrendsData setCategoryNameArray:[self checkForNull:[currentLocalTrends valueForKey:@"categories"]]];
No comments:
Post a Comment