Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

iOS App Still Pauses with Custom Behavior in Background

Discussion in 'Scripting' started by ExbowFTW, Jul 1, 2017.

  1. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    I have a voice recording iOS App. In Player Settings, Behavior in Background is set to Custom, with "Audio, Airplay, PiP" and "Remote Notifications" set to True. However, whenever I press the home button, the app pauses! How do I know it pauses? I have a timer in my app, and when I come back the timer is the same as when I left it.

    This means that the app is still pausing. Am I supposed to also code something to make it continue to run/record audio/run the timer?

    Thanks!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,797
    There's an iOS entitlement/capability that you have to assert (through XCode) that says, "I want to keep running in the background." See:

    https://developer.apple.com/library.../BackgroundExecution/BackgroundExecution.html

    This may require you to tell the actual Apple developer site about it (in regards your specific title bundle) so that you get an updated provisioning profile with that capability, otherwise your phone won't allow it. Google it a bit... you might just have to make sure that Unity is twiddling the right XCode bits and that XCode gets an updated provisioning profile.
     
    idurvesh likes this.
  3. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    Yep, I have already done that in the Capabilities section. (and the problem still persisted).
    Doing this should be enough - it tells Xcode to allow the app to keep running... So I'm pretty perplexed.

    I looked through the Apple Member Center as well for anything - but couldn't find options making the app "even more" background-runnable...