In my project it says Assigning to 'AppDelegate *' from incompatible type 'id'.
What exactly is this? Why did this warning occur?
I have declared in .m
AppDelegate *appdev;
and in viewDidLoad
{ appdev = [[UIApplication sharedApplication]delegate]; <= warning here }
I want to hide this warning. What should I do? Thanks in advance.
since you know they equal, add a cast to let the compiler know
AppDelegate* app = (AppDelegate*)[[UIApplication sharedApplication]delegate];
since this might come up in Swift too
let app = UIApplication.shared.delegate as! AppDelegate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With