我目前正在开发一个基于ResearchKit框架(在objective中编写)的医学研究应用。我目前正在尝试用一个HealthKit问题来创建一个调查。我现在的代码是:
let genderAnswerFormat = ORKHealthKitCharacteristicTypeAnswerFormat(characteristicType: HKCharacteristicTypeIdentifierBiologicalSex)
let genderQuestionStepTitle = "What is your gender?"
let genderQuestionStep = ORKQuestionStep(identifier: "genderQuestionStep", title: genderQuestionStepTitle, answer: genderAnswerFormat)
steps += [genderQuestionStep]但是,第一行将导致一个错误:
无法找到接受类型为“(ORKHealthKitCharacteristicTypeAnswerFormat:String)”的参数列表的“ORKHealthKitCharacteristicTypeAnswerFormat”初始化器
发布于 2015-07-04 00:13:19
您需要将标识符转换为HKObjectType,这是初始化程序的预期参数类型。
https://stackoverflow.com/questions/31214072
复制相似问题