用于iOS的Cordova healthkit插件函数返回undefined? [英] Cordova healthkit plugin functions for iOS are returning undefined?

查看:190
本文介绍了用于iOS的Cordova healthkit插件函数返回undefined?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 cordova-plugin-health 插件获取手机屏幕app我正在努力。每当我使用该应用程序时,每个插件都可以工作但是这个。我正在使用phonegap mac app在iPhone 6s上进行测试。

I am trying to use the cordova-plugin-health plugin for a phonegap app I am working on. Whenever I use the app every plugin works but this one. I am using the phonegap mac app to test on an iPhone 6s.

我采取的步骤:


  1. 已安装的插件包含 cordova插件添加cordova-plugin-health - 变量HEALTH_READ_PERMISSION ='应用程序需要读取权限' - 变量HEALTH_WRITE_PERMISSION ='应用程序需要写入权限'我也做了 cordova平台添加ios

二手 navigator.health.requestAuthorization 稍后尝试 window.plugin.health.requestAuthorization 我的意思是WebStorm能够检测到第二个而不是第一个。

Used navigator.health.requestAuthorization later on tried window.plugin.health.requestAuthorization my ide WebStorm was able to detect the second but not the first.

我有什么遗漏/我可以使用phonegap mac app使用这个插件吗?

Is there anything I missed/can I use this plugin using the phonegap mac app?

谢谢!

推荐答案

Phonegap Developer App是一款可轻松预览应用的工具。
Phonegap开发者应用程序本身就是一个Cordova应用程序,它从本地Web服务器加载您的应用程序代码。
关于Phonegap开发者应用程序的事情是,因为它是一个预编译的应用程序,它只能在构建时运行Phonegap Developer App中包含的插件。
这意味着,大多数第三方插件(如heathkit插件)将无法正常工作,因为它们未包含在Phonegap开发者应用程序中。

Phonegap Developer App is a tool to easily preview your apps. Phonegap Developer App is a Cordova app itself, that loads your app code from a local web server. The thing about the Phonegap Developer App is, as it's a precompiled app, it can only run the plugins that were included on the Phonegap Developer App at the moment of the build. That means, most 3rd party plugins (like the heathkit one) won't work as they are not included in the Phonegap Developer App.

你能做什么就是在您的设备中运行您的应用程序而不是预览它。

What you can do is to run your app in your device instead of previewing it.

要执行此操作,请运行,安装Phonegap CLI并插入设备:

To do it, run, with the Phonegap CLI installed and your device plugged in:

phonegap run ios

如果你安装了Cordova CLI,这个也应该工作

If you have Cordova CLI installed, this should also work

cordova run ios

这篇关于用于iOS的Cordova healthkit插件函数返回undefined?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆