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
消除警告