iOS app gets terminated while playing music in background

Viewed 995

I've developed an iOS music player which plays own music files in background mode. The app is based on React Native 0.48 and uses some third party plugins like music controls and audio-toolkit as sound library.

Since I've installed iOS 11 on my device I'm having the following problem: When I play music in background mode, the app gets terminated after 10-15 minutes with the following message:

Message from debugger: Terminated due to signal 9

This didn't happen on iOS 10, on this older iOS version, the app run fine in background mode. I've also set the correct background modes:

enter image description here

Memory and CPU usage look normally, couldn't find anything special compared to iOS 10:

enter image description here enter image description here

The iPhone has about 500 MB free RAM the whole time. Are there any changes between iOS 10 and iOS 11 that could cause this issue?

3 Answers

As per the documentation provided, it is already mentioned that playing audio in the background on iOS isn't currently supported by this native module.

enter image description here

The issue was caused by the background timer plugin. After removing it, everything worked fine again. I guess that this plugin activates some background mode too and iOS kills the app because of the (long running) job.

I got below bugfix from other forum: https://forums.adobe.com/thread/2387025

No code changes are needed to make this work on compile.

Run the following (tested on 2.1 & 2.1.4-stable branches): scons p=iphone -j 4 target=release tools=no arch=arm64 bits=64 IPHONESDK="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/"

The important part is pointing the iPhoneSDK to the symlinked location instead.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/

Now when the app is suspended/backgrounded, it will not crash and resumes as expected :)

Related