Initializing 'AppDelegate *__strong' with an expression of incompatible type 'id<UIApplicationDelega

来源:互联网 发布:淘宝官方网站注册免费 编辑:程序博客网 时间:2024/05/18 22:13

在写出了除了Home键外退出程序的点击事件时,代码 如下:

AppDelegate *delegate =[UIApplicationsharedApplication].delegate;

报Initializing 'AppDelegate *__strong' with an expression of incompatible type 'id<UIApplicationDelegate> _Nullable'的黄色警告,此时只需要在前面强制转换一下就好 如下代码:

(AppDelegate *)[UIApplicationsharedApplication].delegate

阅读全文
0 0
原创粉丝点击