1

Here is what I want to do: use results from ConsentDocument for view it in ViewController using identifier of step. But signature is always nil. So, how can I get fisrt and last name from 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)}

Here I'm creating step, where user gave me givenName(first name) and familyName(last name). This step named 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)
}

}

rmaddy
  • 314,917
  • 42
  • 532
  • 579
i33r55a99
  • 13
  • 5
  • You should grab the task result from `taskViewController` at the end of the task presentation. Then parse it to get the ORKConsentSignatureResult object. – Yuan May 17 '16 at 20:22

0 Answers0