1

これが私がやりたいことです:ステップの識別子を使用して ViewController で表示するために ConsentDocument の結果を使用します。ただし、署名は常に nil です。では、どうすればConsent Documentから姓と名を取得できますか?

override func viewDidLoad() {
    super.viewDidLoad()
 let signatureResult = ORKConsentSignatureResult(identifier: "ConsentReviewStep")
        let signature = signatureResult.signature

        let label = UILabel(frame: CGRectMake(0, 0, 200, 21))
        label.center = CGPointMake(160, 284)
        label.textAlignment = NSTextAlignment.Center
        label.text = signature?.givenName
self.view.addSubview(label)}

ここでは、ユーザーが givenName(姓) と familyName(姓) を指定したステップを作成しています。このステップの名前はreviewConsentStepです。

@IBAction func joinButtonTapped(sender: UIButton) {
    let consentDocument = ConsentDocument()
    let consentStep = ORKVisualConsentStep(identifier: "VisualConsentStep", document: consentDocument)

    let healthDataStep = HealthDataStep(identifier: "Health")

    let signature = consentDocument.signatures!.first!

    let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, inDocument: consentDocument)

    reviewConsentStep.text = "Review the consent form."
    reviewConsentStep.reasonForConsent = "Consent to join the Developer Health Research Study."

    let passcodeStep = ORKPasscodeStep(identifier: "Passcode")
    passcodeStep.text = "Now you will create a passcode to identify yourself to the app and protect access to information you've entered."

    let completionStep = ORKCompletionStep(identifier: "CompletionStep")
    completionStep.title = "Welcome aboard."
    completionStep.text = "Thank you for joining this study."

    let orderedTask = ORKOrderedTask(identifier: "Join", steps: [consentStep, reviewConsentStep, healthDataStep, passcodeStep, completionStep])
    let taskViewController = ORKTaskViewController(task: orderedTask, taskRunUUID: nil)
    taskViewController.delegate = self

    presentViewController(taskViewController, animated: true, completion: nil)
}

}

4

0 に答える 0