Cocos2D 2.1: “Delegate” deprecated in iOS 6. How do I set the delegate for this AVAudioSession?

后端 未结 4 1484
一整个雨季
一整个雨季 2021-02-05 19:17

Started a Cocos2D 2.1 template (with no physics engine) in Xcode 4.5, targeted for iOS 6 and iPad. In the CDAudioManager.m file, the following code...

AVAudioSe         


        
4条回答
  •  我在风中等你
    2021-02-05 19:55

    The error you are running into is in this block of code

    AVAudioSession* session = [AVAudioSession sharedInstance];
    session.delegate = self;// <-------- DEPRECATED IN IOS 6.0
    

    To silence the warning change those 2 lines to this:

    [[AVAudioSession sharedInstance] setActive:YES error:nil];
    

    Hope this helps.

提交回复
热议问题