//———MyAppDelegate.h
@interface MyAppDelegate : NSObject <UIApplicationDelegate, AVAudioPlayerDelegate> {
//—in some other .m file, trying to acess the device token residing in MyAppDelegate ———-
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
// Results in
// warning: type ‘id ‘ does not conform to the ‘AVAudioPlayerDelegate’ protocol
It is because of a type mismatch:
– The UIApplication.delegate property returns an instance of type id
– You are trying to cast this instance into MyAppDelegate which implements the UIApplicationDelegate and the AVAudioPlayerDelegate protocols.
– As the type returned by the delegate property does not match the appDelegate type, you see the warning.