Gut*_*ty1 4 ios swift healthkit swift2
我有这个代码要求Swift 1.2在升级到Swift 2.0我之后工作的写权限我得到一个奇怪的错误:
... '_' is not convertible to 'HKWorkoutType'
出现错误的代码行:
let healthKitTypesToWrite = Set(arrayLiteral:[
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned),
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning),
HKQuantityType.workoutType()
])
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
添加!前两项:
let healthKitTypesToWrite = Set(arrayLiteral:
[
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned)!,
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning)!,
HKQuantityType.workoutType()
])
Run Code Online (Sandbox Code Playgroud)
这是必需的,因为quantityTypeForIdentifier退货HKQuantityType?
| 归档时间: |
|
| 查看次数: |
242 次 |
| 最近记录: |