start playing audio from a background task via AVAudioPlayer in Xcode

前端 未结 5 1018
小鲜肉
小鲜肉 2021-02-03 14:46

I am trying to start playing a sound from a background task via an AVAudioPlayer that is instantiated then, so here\'s what I\'ve got.

For readability I cut out all user

5条回答
  •  旧巷少年郎
    2021-02-03 14:53

    Seems to me as if you do not have the appropriate background mode set? Xcode screenshot

    Also, looks like another user had the same issue and fixed it with an Apple Docs post. Link to Post

    You may need to just do the step to set the audio session as active:

    [audioSession setActive:YES error:&activationError];
    

    Hope it helps!

提交回复
热议问题