Reputation: 1084
This code produces a "pointer is missing a nullability type specifier" warning in XCode and I can't guess how to silence the warning.
NS_ASSUME_NONNULL_BEGIN
@interface MyClass : NSObject
typedef id (^MyBlock)(id object);
@end
NS_ASSUME_NONNULL_END
The following don't silence the warning:
typedef __nonnull id (^MyBlock)(__nonnull id object);
typedef nonnull id (^MyBlock)(nonnull id object);
I would appreciate any suggestions.
Thank you.
Upvotes: 4
Views: 1359
Reputation: 22930
typedef types don’t usually have an inherent nullability—they can easily be either nullable or non-nullable depending on the context. Therefore, typedef types are not assumed to be nonnull, even within audited regions.[1]
Below syntax is working fine
typedef __nonnull id (^MyBlock)(__nonnull id object);
Upvotes: 3