Xcode8打开后出现swift
⚠️/Users/shuodao/Desktop/iOS-swift-daodaokefu/daodaokefu/popupViewController/LewPopupViewAnimationSpring.m:50:28: Assigning to 'id<CAAnimationDelegate> _Nullable' from incompatible type 'LewPopupViewAnimationSpring *const __strong'spa
出现警告虽然没有什么影响,可是新系统的出现仍是探究一下比较有意思,看着比较明显是由于没有听从协议;对比iOS10 以前,CAAnimationDelegate只是基类的分类方法,是扩展。可是iOS10以后,CAAnimationDelegate从分类变为独立协议方法,不听从协议就出现警告。.net
(通常上代理是weak类型,可是@property(nullable, strong) id <CAAnimationDelegate> delegate;更新以后是strong类型,暂时没有解释)代理
解决:利用宏进行条件编译code
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0get
@interface LewPopupViewAnimationSpring : NSObject<LewPopupAnimation,CAAnimationDelegate>io
#else编译
@interface LewPopupViewAnimationSpring : NSObject<LewPopupAnimation>class
#endif扩展
消除警告