在 ORKStepResult 的数组中找不到将简单答案作为字符串的逻辑或解决方案。它以前使用过这个:
for stepResults in taskViewController.result.results! as! [ORKStepResult] {
for result in stepResults.results! {
switch result.identifier {
case "themaQuestionStep":
if let questionResult = result as? ORKQuestionResult {
questionResultThema = String(questionResult.answer?.objectAtIndex(0))
}
经过一段时间的更新(swift & researchkit),它没有。这条线让我抓狂的是这个:
questionResultThema = String(questionResult.answer?.objectAtIndex(0))
如果我这样做:
questionResultThema = String(describing: questionResult.answer)
它给了我正确的回应,但在一个数组中:
( 6 )>