Ionic [HOW TO] save platform config changes to root config (Anyone?)


#1

If I run ionic build ios open the Xcode project and make changes in Xcode, how do you save the changes in your /platform/projectname/config.xml to the root /config.xml ??? I thought ionic state save did that and then ionic state restore but when I run ionic build ios it still overrides the the project config with root config. Help?


#2

So there are 2 main ways that you can do this.

  1. Use the Root config.xml.

The platform config is generated every build (as you are noticing). This is to incorporate settings that plugins may have. But root config allows you to specify platform specific settings using the <platform name="ios"></platform> tag.

  1. Use a custom cordova hook

If you need something more than that, you can always write a hook that would transform the config.xml. I wrote a sample gulp plugin to do this.


#3

Thanks mhartington for the reply. I checked out your plugin, nice. But let me ask you this, When I run ionic build ios it completely resets a lot of settings (in Xcode) like the Identity and Deployment info.

I know I can update the /root/config.xml but lets say I make changes in Xcode and I’m not sure how it translates into a setting in the root config. For example, I’m using the speech recognition plugin and I need to set the Use BitCode to NO in the Build Settings. So now every time I run any ionic build commands I have to go back and make that change in Xcode because its been reset to what was saved in the Parent Config. Is there a command I can use like ionic state save that will grab Xcode changes, translate those into the root Config.xml with appropriate preferences for iOS?


#4

You should check the Cordova docs. This is already done by default.

http://cordova.apache.org/announcements/2015/12/08/cordova-ios-4.0.0.html