when I get values ββfrom PHP JSON , then I get a problem for __NSCFBoolean isEqualToString :
My code is as follows:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { //convert to JSON for(id key in res) { id value = [res objectForKey:key]; NSString *keyAsString = (NSString *)key; NSString *valueAsString = (NSString *)value; //NSCFBoolean /*if([value isKindOfClass:[NSNumber class]]) { printf("Number"); } else if([value isKindOfClass:[NSString class]]) { printf("String --- \n"); if([value isEqualToString:@"0"]) { printf("Wrong \n"); } else { printf("Right \n"); } }*/ NSLog(@"%@",[valueAsString class]); if([keyAsString isEqualToString:@"success"]) { printf("Working \n"); } else { printf("Not Working\n"); } //Error is in below line if([valueAsString isEqualToString:@"0"])// strcmp([value objCType], @encode(BOOL)) == 1) { [self loginSuccess]; } else if(strcmp([value objCType], @encode(BOOL)) == 0) { [self loginFailure]; } NSLog(@"key: %@", keyAsString); NSLog(@"value: %@", valueAsString); }
}}
Getting problem [__NSCFBoolean isEqualToString:]: unrecognized selector sent to instance 0x1dc9964
Google search for this problem since yesterday, but there is no solution yet. NSCFBoolean is also not available in iOS 6.0, currently. So what could I do to check "0" or "1" from a JSON string? Please help.
source share