美文网首页
Null passed to a callee that req

Null passed to a callee that req

作者: RobinZhao | 来源:发表于2018-12-05 11:22 被阅读0次

这个警告是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 req

      本文链接:https://www.haomeiwen.com/subject/breicqtx.html