How to maintain appname-Info.plist for IOS development


#1

Hi,

I am creating an IOS app in Ionic and I am wondering about some basic stuff.

Say I want this app to only run in landscape mode - I can edit the Orientations under my Xcode project and the settings will be written to my xxxx-Info.plist file right?

But I thought these items were to be edited in the toplevel config.xml file…

Also I need the to set the following keys in the plist file…

NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription

And this should also be possible by using the config.xml file?? Right?

I am a bit confused here…

Basically I want to be able to completely remove platform ios and then add it again where the different properties are being set by entries in the config.xml file.

Am I on the right track??


#2

I’m searching this forum for more info on iOS plist customizations.

How did you solve your problem?


#3

I created a hook that does this. Check out the documentation in the hook below… I believe this was included in the latest yeoman ionic-generator so you could grab it from there too.

https://github.com/djett41/generator-ionic/blob/master/templates/hooks/after_prepare/update_platform_config.js


#4

I was looking for the same and stumbled across this: http://stackoverflow.com/questions/22769111/add-entry-to-ios-plist-file-via-cordova-config-xml

Basically, it tells you that this is not possible through config.xml but rather through plugin.xml of different plugins. In your case, it would make sense to add the following to your geolocation plugin:

	<config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
		<string>Your text</string>
	</config-file>
	<config-file target="*-Info.plist" parent="NSLocationUsageDescription">
		<string>Your text</string>
	</config-file>
	<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
		<string>Your text</string>
	</config-file>

(Note: I added NSLocationUsageDescription in my app to support earlier iOS versions).

Unfortunately, if you have some part of your configuration that does not fit with any plugin you’re forced to put that part into a plugin.xml anyway (that is, if you don’t want to go @djett’s way). I ended up putting parts of my configuration into org.apache.cordova.device.


#5

The downside of this however is that you will be forced to commit your plugins to GIT, which goes against the best practice of keeping platforms/plugins unversioned and controlled through the Cordova CLI and plugin state