Initializing 'Object' *__strong' with an expression of incompatible type 'id <Object> _Nullable
2017-05-15 16:17
483 查看
问题:
出现Initializing ‘Object’ *__strong’ with an expression of incompatible type ‘id _Nullable 的警告
解决办法:
例1:
使用ARC时,获取全局的AppDelegate会有上面的警告。
修改前:
修改后:即(强制转换)
例2:
修改前:
修改后:即(强制转换)
出现Initializing ‘Object’ *__strong’ with an expression of incompatible type ‘id _Nullable 的警告
解决办法:
例1:
使用ARC时,获取全局的AppDelegate会有上面的警告。
修改前:
AppDelegate *app = [UIApplication sharedApplication].delegate;
修改后:即(强制转换)
AppDelegate *app = (AppDelegate*)[UIApplication sharedApplication].delegate;
例2:
修改前:
NIMNotificationObject *object = lastMessage.messageObject;
修改后:即(强制转换)
NIMNotificationObject *object = (NIMNotificationObject *)lastMessage.messageObject;
相关文章推荐
- Initializing 'AppDelegate *__strong' with an expression of incompatible type 'id<UIApplicationDelega
- Initalizing 'AppDelegate * __strong' with an expression of incompatible type ''id<UIApplicatioinDele
- 警告:Initalizing 'AppDelegate * __strong' with an expression of incompatible type ''id<UIApplication..
- Initalizing 'AppDelegate * __strong' with an expression of incompatible type ''id<UIApplicatioinDele
- Initializing 'AppDelegate *__strong' with an expression of incompatible type
- Assigning to "id<CALayerDelegate> _Nullable" from incompatible type "ZXCapture *const __strong" 的警告提示信息
- Sending 'ViewController *const __strong' to parameter of incompatible type 'id<***Delegate>'
- Sending 'xxx *const __strong' to parameter of incompatible type 'id<aDelegate>'
- Sending 'ViewController *const __strong' to parameter of incompatible type 'id<***Delegate>'
- Sending 'AppDelegate *const __strong' to parameter of incompatible type 'id<******Delegate>'
- Xcode编译警告Assigning to 'id<XXXDelegat> ——Nullable' from incompatible type 'XXXView *const_strong'
- <java>No enclosing instance of type GraphicFrame is accessible. Must qualify the allocation with an
- Assigning to 'id<QMapViewDelegate>" from incompatible type "view control * const_strong"
- Assigning to ‘id<UIWebViewDelegate>’ from incompatible type 'xxxViewController *const __strong'
- Assigning to 'id<xxxxDelegate>' from incompatible type 'xxxxViewController *const __strong'
- Sending 'ViewController' to Parameter of Incompatible Type 'id<xxxDelegate>'
- type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds int,java.lang.Object
- 警告⚠️Assigning to 'id<LoginViewDelegate>' from incompatible type 'LoginViewController *__strong'
- Assigning to ‘APPDelegate’ from incompatible type ‘id<UIApplicationDelegate> _Nullable’
- Cannot initialize a parameter of type 'NSString *_Nullable' with an rvalue of type ''UITouchPhase"