Root/config.xml preferences are appended but do not overwrite default platform/appName/config.xml preferences


#1

Hi, new Ionic developer here. I think I may be misunderstanding part of the Cordova build process. Any help would be appreciated.

I create a new Ionic tabs project

ionic start myapp

I edit root/config.xml

< preference name=“AutoHideSplashScreen” value=“false” />

I add and build the iOS platform

ionic platform add ios
ionic build ios

Now platforms/ios/myApp/config.xml contains BOTH a default set of preferences with AutoHideSplashScreen set to true, AND my root config.xml preferences appended to the bottom of the file. How do I avoid this scenario? Am I misunderstanding how to configure the preferences?


#2

Nope this is the correct process. Cordova will append your changes to the end of the config.xml file. Since they are after the original entries, they will be applied.


#3

Okay. Is there a way to modify the preferences generated by the ‘ionic build/emulate/run’ commands so that they aren’t overriding preferences I’m setting in the root config.xml? I feel like that’s probably not complicated but I’m having a hard time finding the relevant documentation.


#4

I think you misunderstood. The preferences you add in your root config.xml do not get over written. It is the default values created by cordova that get overwritten.


#5

I’m new to Ionic and just tried this and am having a problem that although my preference is changed in the root config.xml and although that preference is being appended to the ios platform version of config.xml so that the config.xml has both:

    <preference name="AutoHideSplashScreen" value="true" />

at top and with my preference appended at the bottom to override it:

    <preference name="AutoHideSplashScreen" value="false" />

when I do the cmd line: ionic emulate ios… My app seems to ignore my preference to not auto hide the splash screen.

All I did was:

ionic start splashscreenApp tabs
cd splashscreenApp
ionic platform add ios

then modified the root config.xml to not autohide the splashscreen as indicated above… and then did

ionic emulate ios

but the splashscreen is still autohiding. As indicated above, my config.xml in the ios platform directory is getting my preference appended to the bottom but it seems to be ignored.


#6

I tried it again and somehow it worked this time. I removed my ios platform then readded it then rebuilt it and finally my spashscreen did not auto hide.

ionic platform remove ios
ionic platform add ios

Perhaps something was cached somewhere. I don’t know…