How to associate nullability keywords with multi-level pointer types in following declaration for (NSError **)error
?
- (void)loadSessionForUserId:(nonnull NSString *)userId error:(NSError **)error {
...
}
I want to make error nullable and get rid of “Pointer is missing a nullability type specifier (__nonnull or __nullable)”
Error variant with Xcode11: nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSError *__autoreleasing _Nullable *'
If you are getting a warning, or error if treat-warning-as-error is on for project, on Xcode 9. Use this format for multi-level pointers:
error:(NSError *_Nullable* _Nullable)error
a) With error:(NSError ** _Nonnull)error
Results in compile time error
Nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSError *__autoreleasing *’
b) with error:(NSError * _Nonnull *)error
Results in compile time error
Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
c) with error:(NSError ** _Nullable)error
Results in compile time error Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Open Radar for NSError** without a nullability type shows as a warning which can't be suppressed http://www.openradar.me/21766176
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With