Remote Control Event Causing iOS to Terminate Background App [closed]
Asked Answered
P

0

18

My app plays background audio using AVAudioPlayer and receives remote control events from iOS. Everything works fine while audio is playing, but if audio is paused and my app is moved into the background, something odd happens. If I use a bluetooth device to resume/unpause the audio after 10 minutes, iOS terminates my app with the following message:

<MyApp>[633] has active assertions beyond permitted time:
{(
     <SBProcessAssertion: 0x25f520> identifier: com.apple.mediaremote.sendremotecommand process: <MyApp>[633] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:58
)}

There are two very odd things about this.

  1. iOS will not shutdown my app right at the 10 minute mark. It will only do it after receiving remote control command via bluetooth.

  2. If I use iOS's remote control buttons or the remote control on my headphones, my app will resume playing audio with no trouble.

I cannot figure out why a bluetooth remote control message would cause iOS terminate my app. I've been able to confirm that the Pandora app does not appear to have a similar problem.

Does anyone have a clue about this?

Update: Further testing reveals a clearer description of the bug. It appears that this forced iOS crash of the application happens when attempting to resume background audio after the audio has been paused for 10 minutes or more and the application has experienced a low memory warning.

The following steps are necessary to reproduce the bug:

  1. Either pause the application's audio and then send it to the background (hit the home button or switch to another app) or pause the application's audio while it is in the background
  2. Cause the application to experience a low memory warning (either simulated or real)
  3. After 10 minutes attempt to play audio using a remote control event triggered from a device such as a Bluetooth device or speaker dock, etc.

Note: iOS only seems to force-crash the application when the final remote control event is initiated from an external device such as a Bluetooth device, speaker dock or car adapter. Using iOS's built-in "remote control" interface or remote controls on headphones do not appear to cause the crash.

Like George mentioned in the comments, I've been able to reproduce this with my own App, Pandora and at least one other audio-playing app. I've filed a bug report with Apple.

Peculiarity answered 17/9, 2010 at 20:57 Comment(6)
This problem actually occurs with the Pandora app as well.Beetner
You may want to report this behavior to Apple via radar.apple.comKhamsin
This seems like a question and an answer rolled into one. Consider answering your own question, so this does not show up in "unanswered questions" queries...Szymanski
@Szymanski I do not agree. It's merely a question updated with more information.Proliferate
Doesn't the question boil down to "why does this happen?" And the answer: "it's a bug in Apple's software." Is there a publicly accessible link to the bug report filed with Apple?Szymanski
Did you try setting the "Uses Bluetooth LE accessories" background mode in your app?Parsnip

© 2022 - 2024 — McMap. All rights reserved.