nativescript,angular2和heaththkit-找不到HKHealthStore; [英] nativescript, angular2 and heaththkit - HKHealthStore not found;

查看:107
本文介绍了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 文件:

var healthStore: HKHealthStore; 

cant find name HKHealthStore

如何正确导入?

谢谢

推荐答案

该示例距NativeScript成立之初只有2岁.当时看来平台类型定义是tns_modules的一部分,所以这就是该项目将它们加入板载的原因(在HKHealthStore) HealthKit/master/app/tns_modules/ios.d.ts"rel =" nofollow noreferrer> https://raw.githubusercontent.com/NativeScript/sample-iOS-HealthKit/master/app/tns_modules/ios.d.ts ).

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;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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