Pages

Monday, February 4, 2013

Check JSON String which is 0 or 1

Hi,

 As i have gone through with the JSON String check wether its 0 or 1. Then found NSCFBoolean conversion issue. And iOS 6 doesn't support NSCFBoolean conversion so to resolve this, Following is the best

As my previous blog about the JSON integration, if value is 0 or 1 as in below code.


for(id key in res) {
        id value = [res objectForKey:key];

        NSString *keyAsString = (NSString *)key;
        NSString *valueAsString = (NSString *)value;
You can check value with 0 or 1 with Boolean, as follow
[value boolValue] == YES
or directly if(![value boolValue])

No comments:

Post a Comment