现象:使用ARC时,获取全局的AppDelegate会有警告Initalizing 'AppDelegate * __strong' with an expression of incompatible type ''id<UIApplicationDelegate>"。
原因:类型不一致
解决办法:强制类型转换
实例:
修改前:
AppDelegate *app = [UIApplication sharedApplication].delegate;
修改后:即(强制转换)
AppDelegate *app = (AppDelegate*)[UIApplication sharedApplication].delegate;