gpt4 book ai didi

ios - 我对 ORKResultPredicate 的 predicateForConsent 函数有问题

转载 作者:行者123 更新时间:2023-11-30 12:50:54 25 4
gpt4 key购买 nike

当我点击“同意”按钮时,它应该转到“同意完成步骤”,但它会转到“同意不同意步骤”。请问谁能指出这是什么问题吗?

let consentTask = ORKNavigableOrderedTask(identifier: String(describing:Identifier.consentTask), steps: [reviewConsentStep, disAgreeStep, completionStep])

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

let agreePredicateRule = ORKPredicateStepNavigationRule(
resultPredicatesAndDestinationStepIdentifiers: [
(predicateAgree,
String(describing: Identifier.consentCompletionStep))])

consentTask.setNavigationRule(
agreePredicateRule,
forTriggerStepIdentifier:String(
describing:Identifier.consentReviewStep))

let consentDirectRule = ORKDirectStepNavigationRule(
destinationStepIdentifier: ORKNullStepIdentifier)
consentTask.setNavigationRule(
consentDirectRule,
forTriggerStepIdentifier:String(
describing:Identifier.consentDisagreeStep))

最佳答案

问题在于传递给 +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)

关于ios - 我对 ORKResultPredicate 的 predicateForConsent 函数有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40998215/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com