My tree structure looks like in FireBase
A couple of things. To test for null you should really
if (snapshot.value == [NSNull null])
Here's a slightly modified implementation of your code that includes the NSNull check.
Firebase *ref = [self.myRootRef childByAppendingPath:@"users"];
FQuery *query = [[ref queryOrderedByKey] queryEqualToValue:@"UserC_ID"];
[query observeSingleEventOfType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {
if (snapshot.value == [NSNull null]) {
NSLog(@"was null");
} else {
NSLog(@"key: %@ %@", snapshot.key, snapshot.value);
}
}];
I set up a test Firebase with the same structure you are using and it works correctly; returns null for nonexistent user id's and returns the node UserC_ID when it does.
So maybe your code that sets the userIDKey is misbehaving or perhaps your userRef is wonky.