Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.xml rewritten by ionic cordova build #86

Closed
ghost opened this issue Oct 28, 2017 · 14 comments
Closed

config.xml rewritten by ionic cordova build #86

ghost opened this issue Oct 28, 2017 · 14 comments
Labels
help wanted I am not sure I can solve this, help needed!

Comments

@ghost
Copy link

ghost commented Oct 28, 2017

FIrst, thank you for the amazing plugin. It works awesome in Ionic.

My problem is when I have tried to deploy my app to App store i get the following error.

screen shot 2017-10-28 at 22 52 47

My config.xml

  <plugin name="cordova-plugin-health" spec="^1.0.0">
        <variable name="HEALTH_READ_PERMISSION" value="We need you approval to analyse your current health state" />
        <variable name="HEALTH_WRITE_PERMISSION" value="We need you approval to analyse your current health state" />
   </plugin>

Can you help men with my problem ?

EDIT 1:

this is my app info.plist file entry

<key>NSHealthShareUsageDescription</key>
<string></string>
<key>NSHealthUpdateUsageDescription</key>
<string></string>

So why then the information from the config.xml is not propagated to the info.plist file?

@dariosalvi78 dariosalvi78 added the help wanted I am not sure I can solve this, help needed! label Oct 29, 2017
@dariosalvi78
Copy link
Owner

dariosalvi78 commented Oct 29, 2017

Not sure what confide.xml is, but the info.plist is obviously empty.
The README clearly says:

Installation

In Cordova:
cordova plugin add cordova-plugin-health --variable HEALTH_READ_PERMISSION='App needs read access' --variable HEALTH_WRITE_PERMISSION='App needs write access'
HEALTH_READ_PERMISSION and HEALTH_WRITE_PERMISSION are shown when the app tries to grant access to data in HealthKit.

This will populate your info.plist automatically. Alternatively, you can specify the strings yourself.

@ghost
Copy link
Author

ghost commented Oct 29, 2017

@dariosalvi78

I had spelling mistake - it is config.xml

I have installed the plugin in the exactly same way as written in the README file.

But when i run ionic cordova build ios --prod --release --device or ionic cordova prepare, my entries containing the text (from the config.xml) are replaced with

<plugin name="cordova-plugin-health" spec="^1.0.0">
        <variable name="HEALTH_READ_PERMISSION" value=" " />
        <variable name="HEALTH_WRITE_PERMISSION" value=" " />
</plugin>

@dariosalvi78
Copy link
Owner

I don't know really. I usually compile with Xcode directly.

Try adding --variable HEALTH_READ_PERMISSION='App needs read access' --variable HEALTH_WRITE_PERMISSION='App needs write access' to the cordova build command ?

@dariosalvi78 dariosalvi78 reopened this Oct 29, 2017
@ghost
Copy link
Author

ghost commented Oct 29, 2017

Well I guess I can do that, but it would be nice the plugin to work as expected, when the command 'ionic cordova build ios --prod --release --device' is executed (not to reset the values and write it to the .plist ).

@dariosalvi78
Copy link
Owner

The config.xml is correctly configured at installation time. It may be a problem introduce by ionic, I have no control over it.

@dariosalvi78 dariosalvi78 changed the title iOS deployment problem config.xml rewritten by ionic cordova build Oct 29, 2017
@ghost
Copy link
Author

ghost commented Oct 30, 2017

I have found the problem.

The project's config.xml values are overwritten by the ones in the package.json.

The proper plugin variable values must be stated in the package.json of the project.

@ghost ghost closed this as completed Oct 30, 2017
@dariosalvi78
Copy link
Owner

you mean the plugin's package.json or your project's package.json?

@ghost
Copy link
Author

ghost commented Oct 30, 2017

@dariosalvi78 I have updated my previous comment.

@dariosalvi78
Copy link
Owner

Thanks, could you please suggest a modification to the README either by posting it here, or by doing a pull request so that people who run into the same issue know what to do?
That would be appreciated....

@ghost
Copy link
Author

ghost commented Oct 30, 2017

@dariosalvi78
I am not sure in which paragraph it should go, but the explanation that I would like to have is:

"Changing HEALTH_READ_PERMISSION or HEALTH_WRITE_PERMISSION, after the initial installation can be done ONLY in the project's package.json file.

Changes of this values directly in the config.xml will be overwritten when cordova prepare is called as a part of any command pipeline"

package.json values example

...
"cordova-plugin-health": {
        "HEALTH_READ_PERMISSION": "We need you approval",
        "HEALTH_WRITE_PERMISSION": "We need you approval"
      }
...

@ghost
Copy link

ghost commented Oct 30, 2017

could you post an example of what would need to be inside the package.json ?

@marcovtwout
Copy link

I ran into the same issue when using the Ionic Package cloud service to build the app. Config.xml is configured correctly, but the values are missing from Info.plist. I will try the solution in #86 (comment) and report back here.

@marcovtwout
Copy link

Yes, that works! When cloud building with Ionic Package, package.json needs to be configured like this:

{
  "cordova": {
    "plugins": {
     "cordova-plugin-health": {
        "HEALTH_READ_PERMISSION": "App needs read access",
        "HEALTH_WRITE_PERMISSION": "App needs write access"
      },
    },
  }
}

Could you add this to the README?

@pushparajsamant
Copy link

Just FYI if your plugins folder has a fetch.json and it has a usage description, then it is picked up from there when you delete and readd the platform.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted I am not sure I can solve this, help needed!
Projects
None yet
Development

No branches or pull requests

3 participants