Our ionic program, sometimes need to run in the background, this time we need to refer to Cordova-plugin-background-mode, the current version of 0.7.2. However, there is a problem with using this version of plugin on iOS devices today.
This problem currently has the following 2 solutions.
1. Visual Studio Code opens the Ionic project, opens the terminal, runs the command: Ionic Cordova Platform Add iOS, after the command is run, open with Xcode located in \platforms\i Os\*.xcodeproj the project. Search keywords: _requiresuseractionformediaplayback, delete the starting character ' _ ', that is, replace the Requiresuseractionformediaplayback, refer to Picture 1. This method is not good enough, and each time you deploy to an iOS device, you need to do this replacement.
<< Photo 1>>
2. It is also a better method at present. Run through the command line at the terminal of the Ionic project: Ionic Cordova plugin Add Https://github.com/katzer/cordova-plugin-background-mode--nofetch. After you deploy to your iOS device, everything works fine. That said, the latest GitHub version has been modified to the _requiresuseractionformediaplayback exception, but in the NPM package has not been resolved. So here's the recommended scenario 2.
Ionic Project referencing Background Mode, an exception was resolved when deploying to an iOS device