我遇到了ORKResultPredicate的predicateForConsent函数问题

时间:2016-12-06 14:52:57

标签: ios swift researchkit

当我点击“同意”按钮时,它应该转到consentCompletionStep但它会同意不同意步骤。任何人都可以指出问题是什么吗?

userid      date          count
a           2016-12-01    4
a           2016-12-03    5
a           2016-12-05    1
b           2016-11-17    14
b           2016-11-18    15
b           2016-11-23    4

1 个答案:

答案 0 :(得分:0)

问题是传递给+predicateForConsentWithResultSelector:didConsent:的resultSelector必须提供所需的步骤标识符(stepIdentifier参数)和所需的签名标识符(resultIdentifier参数)。

而不是:

let resultSelector = ORKResultSelector(resultIdentifier:String(describing: Identifier.consentReviewStep))
let predicateAgree = ORKResultPredicate.predicateForConsent(with: resultSelector, didConsent: true)

应该是:

let resultSelector = ORKResultSelector(stepIdentifier: String(describing: Identifier.consentReviewStep), resultIdentifier: signature.identifier)
let predicateAgree = ORKResultPredicate.predicateForConsent(with: resultSelector, didConsent: true)