本文介绍了nativescript、angular2 和 heaththkit - 未找到 HKHealthStore;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试遵循 https://github.com/NativeScript/sample 上的文档-iOS-HealthKit 让我们面对它的记录很差...... tsk tsk tsk

I am trying to follow the docs at https://github.com/NativeScript/sample-iOS-HealthKit which lets face it is poorly documented... tsk tsk tsk

我在我的 xcode 项目中启用了 healthkit.

I have healthkit enabled in my xcode project.

根据此示例 https://github.com/NativeScript/sample-iOS-HealthKit/blob/master/app/components/main/main.ts 我正在尝试导入的文件:

Per this sample https://github.com/NativeScript/sample-iOS-HealthKit/blob/master/app/components/main/main.ts file I am trying to import:

var healthStore: HKHealthStore;

cant find name HKHealthStore

如何正确导入?

谢谢

推荐答案

该示例已有 2 年历史,从 NativeScript 的早期开始.看起来平台类型定义当时是 tns_modules 的一部分,所以这就是为什么项目包含它们(在 ).

That sample 2 years old, from the very early days of NativeScript. Looks like the platform type definitions were part of tns_modules back then, so that's why the project has them on board (look for HKHealthStore in https://raw.githubusercontent.com/NativeScript/sample-iOS-HealthKit/master/app/tns_modules/ios.d.ts).

您需要添加此插件并按照说明在您的项目中获取 HealthKit 类型和代码完成:https://www.npmjs.com/package/tns-platform-declarations

You'll need to add this plugin and follow the instructions to get HealthKit typings and code completion in your project: https://www.npmjs.com/package/tns-platform-declarations

这篇关于nativescript、angular2 和 heaththkit - 未找到 HKHealthStore;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:12