Search code examples
objective-ciosuitabbar

Red bar on iOS application


I am developing an application and something really strange happened. I added on my main view controller a tab bar on the bottom of the screen and from that moment when i start the application , or when i close it and it works on background and open it again a red bar like a navigator bar appears like a flash on the top of the screen. Does anyone have any idea what this could be?

Imagine that when you start the application something like a toolbar/navigation bar appears on top just for like half a second. I noticed that inside this bar the name of the application appears


Solution

  • This happens when your app is set to run in the background (e.g. after screen lock or while another app is running.)

    For example, if you have audio background services enabled in your info.plist with this:

        <key>UIBackgroundModes</key>    <array>
          <string>audio</string>    </array>
    

    And you have an active audio session with the correct category, then your app will display the red bar with your app name. To turn it off you need to stop the audio stream (by stopping the audio unit or the graph,) and I think you also need to set the audio services to off with AudioSessionSetActive(false)