Null passed to a callee that requires a non-null argument

这个警告是xcode6.3开始 为了让OC也能有swift的 ?和 !的功能,你在声明一个属性的时候加上 __nullable(?可以为空)与__nonnull(!不能为空) 如果放在@property里面的话不用写下划线

@property (nonatomic, copy, nonnull) NSString * title;
@property (nonatomic, copy) NSString * __nonnull subTitle;
@property (nonatomic, copy, nullable) NSString * title;
@property (nonatomic, copy) NSString * __nullable subTitle;

或者用宏NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END 包住多个属性全部具备nonnull,然后仅对需要nullable的改下就可以了。

你可能感兴趣的:(Null passed to a callee that requires a non-null argument)