-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIRRemoteConfigValue.stringValue is not nullable #10870
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hi @myihsan, Thanks for opening an issue. Just so I understand the issue correctly, is the issue that the implementation's return type does not have the So something like the below diff would resolve things: - - (NSString *)stringValue {
+ - (nullable NSString *)stringValue { |
Hi @ncooke3, Thanks for the confirmation. firebase-ios-sdk/FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h Line 110 in 60f9a33
I expected it to be solved like the below: - (NSString *)stringValue {
// if `_data` is nil or empty return nil.
if (!_data) {
return nil;
}
return [[NSString alloc] initWithData:_data encoding:NSUTF8StringEncoding];
} But it will affect Before that, marking - @property(nonatomic, readonly, nullable) NSString *stringValue;
+ @property(nonatomic, readonly, nonnull) NSString *stringValue; |
I think what is going on here is that Apple's documentation is misleading. Based on this discussion section and that Swift equivalent returns |
You are right and the return value section mentioned that.
However, it will not return nil in the cases below:
You can verify this behavior by: NSLog(@"%@", [[NSString alloc] initWithData:[[NSData alloc] init] encoding:NSUTF8StringEncoding] == nil ? @"True" : @"False");
NSLog(@"%@", [[NSString alloc] initWithData:nil encoding:NSUTF8StringEncoding] == nil ? @"True" : @"False"); |
Thanks @myihsan, that's interesting. Sorry, so what exactly is the issue with the current behavior? Is it that you expected |
Yes or no since I am unsure when I want to distinguish the situations below:
|
While we may progress earlier, I'll mark this as Firebase 11 to make sure we consider before our next breaking change release. |
Description
FIRRemoteConfigValue.stringValue is marked
nullable
in the header file but will never returnnull
as the implement.firebase-ios-sdk/FirebaseRemoteConfig/Sources/FIRConfigValue.m
Lines 43 to 46 in 60f9a33
It would be thankful to implement it as
nullable
, before that marking itnonnull
would be enough.Firebase SDK Version
9.6.0
Xcode Version
14.1
Installation Method
CocoaPods
Firebase Product(s)
Remote Config
Targeted Platforms
iOS
The text was updated successfully, but these errors were encountered: