iOS10中CAAnimationDelegate适配问题

Xcode8打开后出现

⚠️/Users/shuodao/Desktop/iOS-swift-daodaokefu/daodaokefu/popupViewController/LewPopupViewAnimationSpring.m:50:28: Assigning to 'id<CAAnimationDelegate> _Nullable' from incompatible type 'LewPopupViewAnimationSpring *const __strong'

出现警告虽然没有什么影响,但是新系统的出现还是探究一下比较有意思,看着比较明显是因为没有遵从协议;对比iOS10 之前,CAAnimationDelegate只是基类的分类方法,是扩展。但是iOS10之后,CAAnimationDelegate从分类变为独立协议方法,不遵从协议就出现警告。

(一般上代理是weak类型,但是@property(nullable, strong) id <CAAnimationDelegate> delegate;更新之后是strong类型,暂时没有解释)

解决:利用宏进行条件编译

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0

@interface LewPopupViewAnimationSpring : NSObject<LewPopupAnimation,CAAnimationDelegate>

#else

@interface LewPopupViewAnimationSpring : NSObject<LewPopupAnimation>

#endif

 

消除警告

转载于:https://my.oschina.net/u/2532095/blog/755747

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值