OCSafeMethod SafeMethods of NSDictionary and NSArray install pod 'OCSafeMethod' useage temp code: NSDictionary *dictionary = [self getData]; NSString *result = [dictionary stringForKey:@"ret"]; NSInteger count = [dictionary integerForKey:@"count"];