也不是报错吧,只是一个警告,但强迫自己必须处理掉
Null passed to a callee that requires a non-null argument
此警告就是某属性说好的不能为空,你又在某地方写了XX = nil 所以冲突了
这个警告比较新,是xcode6.3开始 为了让OC也能有swift的?和!的功能,你在声明一个属性的时候加上 __nullable(?可以为空)与__nonnull(!不能为空) 如果放在@property里面的话不用写下划线
@property (nonatomic, strong) NSNumber *__nullable ID;
或者用宏NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END 包住多个属性全部具备nonnull,然后仅对需要nullable的改下就行
最开始这样写
+ (BillYardsHeadInputDataModel *)yardsShowTypeQtyIsPositNumWithYardsHeadInputDataModel:(BillYardsHeadInputDataModel *)inputDataModel
withAlertBlock:(nonnull void (^)(NSString * _Nonnull alertStr))alertBlock
后来改为这样
+ (BillYardsHeadInputDataModel *)yardsShowTypeQtyIsPositNumWithYardsHeadInputDataModel:(BillYardsHeadInputDataModel *)inputDataModel
withAlertBlock:(void (^ _Nullable )(NSString * _Nonnull alertStr))alertBlock
Nullability specifier '_Nullable' cannot be applied to non-pointer type 'void'; did you mean to apply the specifier to the block pointer?
Replace '__nullable void (^' with 'void (^ _Nullable '
Nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'