2015-07-03 78 views
0

我目前正在基於ResearchKit框架(它是用Objective-C編寫的)在swift中開發醫學研究應用程序。我目前正在嘗試用HealthKit問題創建一項調查。我現在有作爲的代碼是:Swift ResearchKit HealthKit問題步驟

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

然而,第一行會導致錯誤:

無法找到接受型characteristicType的「(參數列表「ORKHealthKitCharacteristicTypeAnswerFormat」的初始化:字符串)'

回答

2

您需要將標識符轉換爲HKObjectType,這是初始值設定項的預期參數類型。