1
初始化xcode 8中的appdelegate对象,引发警告。有什么不对的语法如下初始化xcode 8中的Appdelegate对象
AppDelegate *del=[[UIApplication sharedApplication]delegate];
初始化xcode 8中的appdelegate对象,引发警告。有什么不对的语法如下初始化xcode 8中的Appdelegate对象
AppDelegate *del=[[UIApplication sharedApplication]delegate];
我给你另一种选择使用的appdelegate对象和decalre它appdelegate.h文件中像这样
#define theAppDelegate \
((AppDelegate *)[UIApplication sharedApplication].delegate)
希望这个作品罚款
它抛出什么警告? AppDelegate是你自己的'UIAppDelegate'子类吗?然后'AppDelegate * del =(AppDelegate *)[[UIApplication sharedApplication] delegate];'可以解决这个问题,但如果它不是'AppDelegate'对象,它可能会破坏它。 – Larme