通过Research-Kit管理结果

时间:2019-05-03 14:19:15

标签: ios swift researchkit

我正在使用ResearchKit中的空间存储任务,并尝试使用cocoapods实现ResearchKit。我将ResearchKit中的代码呈现为:

public var ActiveTask: ORKOrderedTask {
    return ORKOrderedTask.spatialSpanMemoryTask(withIdentifier: "SpatialMemoryTask",
                                                           intendedUseDescription: "Blah, blah",
                                                           initialSpan: 3,
                                                           minimumSpan: 1,
                                                           maximumSpan: 4,
                                                           playSpeed: 0.5,
                                                           maximumTests: 3,
                                                           maximumConsecutiveFailures: 4,
                                                           customTargetImage: nil,
                                                           customTargetPluralName: nil,
                                                           requireReversal: false,
                                                           options: ORKPredefinedTaskOption())

}

现在,我想从ResearchKit中获得答案,例如-正确的序列,已回答的序列,得分,已回答的序列的时间戳,花朵开始闪烁时正确的序列的时间戳。

我确实在这样的方法中写入了结果:

    func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskViewControllerFinishReason, error: Error?) {
        let taskResult = taskViewController.result
        print(taskResult)
        let stepResult = taskResult.stepResult(forStepIdentifier: "cognitive.memory.spatialspan")
        if let result = stepResult?.firstResult as? ORKSpatialSpanMemoryResult
        {
            print(result)
        }

        dismiss(animated: true, completion: nil)
        taskViewController.view.removeFromSuperview()
        taskViewController.removeFromParent()
    }

但是我无法获得结果,有人可以帮我这个忙吗?打印命令的输出如下

<ORKTaskResult: 0x6000030b7020; identifier: "SpatialMemoryTask"; results: (
    <ORKStepResult: 0x6000030ba800; identifier: "instruction"; enabledAssistiveTechnology: None; results: ()>,
    <ORKStepResult: 0x6000030a6f80; identifier: "instruction1"; enabledAssistiveTechnology: None; results: ()>,
    <ORKStepResult: 0x6000030be620; identifier: "cognitive.memory.spatialspan"; enabledAssistiveTechnology: None; results: (
        <ORKSpatialSpanMemoryResult: 0x6000030bdcc0; identifier: "cognitive.memory.spatialspan"; score: 165>
    )>,
    <ORKStepResult: 0x6000030b6990; identifier: "conclusion"; enabledAssistiveTechnology: None; results: ()>
)>
<ORKSpatialSpanMemoryResult: 0x6000030bdcc0; identifier: "cognitive.memory.spatialspan"; score: 165>

有人可以帮助我获得结果,并告诉我我做错了什么事。

0 个答案:

没有答案