问题
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