为什么Xcode在appdelegate.h文件中使用AVAudioPlayer代理协议时显示警告?

为什么Xcode在appdelegate.h文件中使用AVAudioPlayer代理协议时显示警告?,xcode,avaudioplayer,uiapplicationdelegate,Xcode,Avaudioplayer,Uiapplicationdelegate,//---------MyAppDelegate.h @interface MyAppDelegate : NSObject <UIApplicationDelegate, AVAudioPlayerDelegate> { //导致 //警告:类型“id”不符合“AVAudioPlayerDelegate”协议,这是由于类型不匹配造成的: -UIApplication.delegate属性返回id类型的实例 -您正在尝试将此实例强制转换为MyAppDelegate,它实现UIApp

//---------MyAppDelegate.h

@interface MyAppDelegate : NSObject <UIApplicationDelegate, AVAudioPlayerDelegate> {
//导致
//警告:类型“id”不符合“AVAudioPlayerDelegate”协议,这是由于类型不匹配造成的: -UIApplication.delegate属性返回id类型的实例 -您正在尝试将此实例强制转换为MyAppDelegate,它实现UIApplicationDelegate和AVAudioPlayerDelegate协议。
-由于委托属性返回的类型与appDelegate类型不匹配,您会看到警告。

这是因为类型不匹配: -UIApplication.delegate属性返回id类型的实例 -您正在尝试将此实例强制转换为MyAppDelegate,它实现UIApplicationDelegate和AVAudioPlayerDelegate协议。 -由于委托属性返回的类型与appDelegate类型不匹配,您将看到警告

MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];