简体   繁体   中英

How do I properly add settings to an iOS app with a Cordova project?

In a Cordova build I am trying to add settings for my iOS application. I have the settings already defined in a Settings.bundle/Root.plist file. All I want is the Settings.bundle copied over to the XCode project along with its children.

I'm trying to do this with a resource-file statement:

<platform name="ios"> <resource-file src="res/ios/Settings.bundle" /> ... </platform>

When I do my build, the folder is added 3 times to my project instead of only one time, and none of the files inside that folder is copied over. I see in the log output that there are 3 CpResource statements executed for this resource.

CpResource Anamnese\\ mobil/Resources/res/ios/Settings.bundle build/emulator/Anamnese\\ mobil.app/Settings.bundle CpResource Anamnese\\ mobil/Resources/res/ios/Settings.bundle build/emulator/Anamnese\\ mobil.app/Settings.bundle CpResource Anamnese\\ mobil/Resources/res/ios/Settings.bundle build/emulator/Anamnese\\ mobil.app/Settings.bundle

This is consistent with what I'm seeing in the resulting XCode project: The folder is there 3 times, but it has no contents. I played around with the location of the Settings.bundle and the number of file inside to see whether there is a relation to the number of times this is executed, but to no avail.

So, my question is, how do I properly add settings to an iOS app with Cordova?

Or, if I stay on this level of analysis: How do I properly copy folder structures into an iOS project?

I didn't find why resource-file added the Settings.bundle three times. But I figured out another way to integrate it into the app: I had to declare an own cordova plug-in that listed this Settings.bundle.

David Souther wrote a detailed instruction here: Cordova Phonegap IOS App Settings.Bundle Possible?

To install me.apla.cordova.app-preferences I had to also include this line into my cordova.xml

<plugin name="cordova-plugin-app-preferences" spec="https://github.com/apla/me.apla.cordova.app-preferences" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM