Swift Nullability and Objective-C Blog Entry :
The specific type NSError ** so often used to return errors through method parameters that are always considered a null pointer to a null value of NSError .
However, this remark is indicated as an exception to the โAudited Regionsโ rules, and it seems to apply only within the audited region:
NS_ASSUME_NONNULL_BEGIN @interface MyClass : NSObject - (NSArray<MyObj *> * _Nullable)foo:(NSError **)error; @end NS_ASSUME_NONNULL_END
Within the scope of the test, any simple pointer type will be considered nonnull (with some exceptions, as indicated above for NSError ).
Outside of the scope you are checking, you really need to write explicitly
- (NSArray<MyObj *> * _Nullable)foo:(NSError * _Nullable * _Nullable)error;
to avoid warnings about missing nullability type specifiers.
( _Nullable is the new syntax used in Xcode 7 and replaces __nullable .)
Martin R Oct 18 '15 at 2:08 2015-10-18 14:08
source share