无法初始化参数

时间:2015-03-23 01:22:39

标签: ios

我收到此错误:

  

无法初始化'id'类型的参数   使用'VDLPlaybackViewController * const __strong'

类型的左值

来自这行代码:

[[AVAudioSession sharedInstance] setDelegate:self];

我该如何解决?

1 个答案:

答案 0 :(得分:1)

我认为您应该在VDLPlaybackViewController.h

中添加此代码
 @interface VDLPlaybackViewController: UIViewController <AVAudioSessionDelegate>

AVAudioSessionDelegate已弃用iOS6

/* The delegate property is deprecated. Instead, you should register for the NSNotifications named below. */
/* For example: 
 [[NSNotificationCenter defaultCenter] addObserver: myObject 
 selector:    @selector(handleInterruption:) 
 name:        AVAudioSessionInterruptionNotification 
 object:      [AVAudioSession sharedInstance]]; 
 */
@property(assign) id<AVAudioSessionDelegate> delegate NS_DEPRECATED_IOS(4_0, 6_0);

尝试按下此post来初始化声音设置。