【问题标题】:Swift ResearchKit HealthKit QuestionStepSwift ResearchKit HealthKit QuestionStep
【发布时间】:2015-07-03 20:51:51
【问题描述】:

我目前正在 swift 中开发一个基于 ResearchKit 框架(用 Objective-c 编写)的医学研究应用程序。我目前正在尝试创建一个带有 HealthKit 问题的调查。我现在的代码是:

    let genderAnswerFormat = ORKHealthKitCharacteristicTypeAnswerFormat(characteristicType: HKCharacteristicTypeIdentifierBiologicalSex)
    let genderQuestionStepTitle = "What is your gender?"
    let genderQuestionStep = ORKQuestionStep(identifier: "genderQuestionStep", title: genderQuestionStepTitle, answer: genderAnswerFormat)
    steps += [genderQuestionStep]

但是,第一行导致错误:

找不到接受“(characteristicType: String)”类型参数列表的“ORKHealthKitCharacteristicTypeAnswerFormat”的初始化程序

【问题讨论】:

    标签: ios swift healthkit researchkit


    【解决方案1】:

    您需要将标识符转换为 HKObjectType,这是初始化程序的预期参数类型。

    【讨论】:

      猜你喜欢
      • 2015-09-22
      • 2015-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多