How to tell IOS to await hooks to be ended in Cordova?

451 Views Asked by At

I am running these hooks:

<hook src="hooks/before-build/controller.js" type="before_build" />
<hook src="hooks/before-build/controller.js" type="before_run" />
<hook src="hooks/after-build/controller.js" type="after_build" />
<hook src="hooks/after-build/controller.js" type="after_run" />

They simply replace variables in the config.xml file so it will be fitted to staging or production environments respectively.

For example, take this line:

<preference name="APP_SECRET" value="ANDROID-APPCENTER-APP-SECRET" />

And replace the secret.

After the build has done, it re-fills the config.xml with the old values again - for next build to have the old references for next use.

In Android this works just awesome - I have different generated config.xml for stage or prod. But in IOS I receive this error when I am trying to run or build:

The product name change (<name> tag) in config.xml is not supported dynamically.
To change your product name, you have to remove, then add your ios platform again.
Make sure you save your plugins beforehand using `cordova plugin save`.
    cordova plugin save
    cordova platform rm ios
    cordova platform add ios

I think that IOS starts to build without async waiting to the hooks to be done. And therefore it tries to build without a proper config.xml file and then having error.

How to tell IOS to await the hook to be ended and by the time this happens, to start building with the new config.xml?

0

There are 0 best solutions below