Add entry to iOS .plist file via Cordova config.xml

后端 未结 15 1464
日久生厌
日久生厌 2020-11-28 21:41

I am new to the Cordova CLI.

I need to perform the following steps programmatically via Cordova.

  1. In the project .plist add a new row
  2. Enter th
15条回答
  •  醉梦人生
    2020-11-28 22:17

    These are the steps I ended up doing to enable my application to share files through itunes between devices.

    1.In your application navigate to your config.xml. Type this piece into your config under the platform tag .

     
          
      
    

    2. Then go to your command line tool and type: cordova prepare

    1. Uninstall and reinstall your application on your device, and you will see your app appear in itunes for you to share any files between your devices.

    A few things, make sure cordova is up to date, and that you added the platform for ios.

    npm install -g cordova
    

    This command installs cordova.

    cordova platform add ios
    

    This command adds the platform for ios.

    What is happening is when you run the cordova prepare command you are using Apple's Xcode SDK that is generated in the platform/ios folder. There you can see the plist file that is generated for your application, which is labeled as "yourApp-info.plist". There you can see the new key and string produced in the xml layout which looks like this:

     UIFileSharingEnabled
     
    

    Also word of warning, my company dropped this ionic framework application into my lap a couple weeks ago (with a really short deadline). Everything I am telling you is based on couple weeks of learning. So this may not be the best practice, but I hope it helps someone out.

    Edit

    Link to the docs

提交回复
热议问题