【发布时间】:2015-03-05 05:59:37
【问题描述】:
我正在尝试使用CoreMotion、HealthKit 以及所需的一切来计算用户的步数。
一开始我用 Swift 试了一下(我不擅长 swift)并导入了这两个文件:
import HealthKit
import CoreMotion
当我声明CMStepCounter 时,它成功声明了它,意味着找到了类型。我是这样声明的:
let stepCounter:CMStepCounter = CMStepCounter()
继续前进,我陷入了困境,决定转向目标 c,并开始以目标 c 风格编写相同的代码。但是当我宣布它时:
CMStepCounter *_stepCounter;
它给了我错误 Unknown Type Name 'CMStepCounter'。
这是因为我在使用目标 C 时没有导入 CoreMotion 和 HealthKit。那么我怎样才能快速导入上面写的这两个目标c?
【问题讨论】:
标签: objective-c import core-motion healthkit