Ionic Project referencing Background Mode, an exception was resolved when deploying to an iOS device

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.