nativescript, angular2 and heaththkit - HKHealthStore not found;

允我心安 提交于 2020-01-07 04:36:11

问题


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

I have healthkit enabled in my xcode project.

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

How to I import properly?

Thanks


回答1:


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).

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



来源:https://stackoverflow.com/questions/44648018/nativescript-angular2-and-heaththkit-hkhealthstore-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!