How to Play Audio in background in IPhone?

前端 未结 2 609
一向
一向 2021-01-24 05:29

I\'m trying to play audio file at particular time which i have set.for that I have added audio in \"UIBackgroundModes\" in info.plist and backgroundtaskidentifier in didEnterBac

2条回答
  •  無奈伤痛
    2021-01-24 06:28

    If I understand you correctly, you want to play a sound at a particular time, no matter if your app is active and foregrounded at that time? Your only (app review-friendly) option is to schedule a local notification, as in slf's answer. UIBackgroundModes won't help you: the audio background mode is for being allowed to execute code while backgrounded only when you start playing audio when you are foregrounded. Example usages are music players and radio apps.

    If you explain your use case more thoroughly, I might have a better answer.

提交回复
热议问题