0

As my question say, I am creating a ORKConsentReviewStep without the signature. But I would like to know if the user tap 'agree' or 'disagree'.

I tried:

let reviewResult = result.stepResultForStepIdentifier("kReview")
let r = reviewResult?.resultForIdentifier("kReview") as! ORKChoiceQuestionResult
let choice = r.choiceAnswers?.first as! Double

But it will crash.

Edit:

I am using this to get the choice from the SharingStep and was hoping the ReviewStep had the same:

let sharing = result.stepResultForStepIdentifier("kSharingStep") 
let s = sharing?.resultForIdentifier("kSharingStep") as! ORKChoiceQuestionResult 
let theChoice = s.choiceAnswers!.first as! Double
troligtvis
  • 133
  • 2
  • 8
  • I think you need to determine why it's crashing. Does `reviewResult` have a value? Is the `resultForIdentifier("kReview")` the type you're *forcing* it to be? – Craig Otis Jun 01 '15 at 11:01
  • Yea well, I was hoping it would have a value like that ;) I mean because the SharingStep does. It is the same thing but give me a value of 0 or 1 depending if the user want to share or not. let sharing = result.stepResultForStepIdentifier("kSharingStep") let s = sharing?.resultForIdentifier("kSharingStep") as! ORKChoiceQuestionResult let theChoice = s.choiceAnswers!.first as! Double – troligtvis Jun 01 '15 at 11:31
  • Yeah, sharing step is just a question step, so it behaves the same. The review step is not. – jwe Jun 01 '15 at 19:55

2 Answers2

2

Actually, this looks like an oversight. Since all our users have used at least requiresName, and usually also requiresSignatureImage, they have been able to determine whether the user agreed implicitly by whether a name or signature are present.

Note that ORKConsentReviewStep is not a question step, so it does not contain a question result. Its result's child is an ORKConsentSignatureResult which documents the name and/or signature obtained.

What should happen is that if the user does not agree, the review result should have a flag to indicate this explicitly.

I've filed #244

jwe
  • 436
  • 2
  • 4
0

While looking through the files and trying to create an own delegate I found

@protocol ORKConsentReviewControllerDelegate <NSObject>
- (void)consentReviewControllerDidAcknowledge:(ORKConsentReviewController *)consentReviewController;
- (void)consentReviewControllerDidCancel:(ORKConsentReviewController *)consentReviewController;
@end

So here is the answer to my own question :)

troligtvis
  • 133
  • 2
  • 8
  • That's internal to the framework and shouldn't be used at the app level. The _documentReviewed flag it sets needs to get propagated up to the result. – jwe Jun 01 '15 at 17:41
  • @jwe : yes I noticed that. But the app I am creating doesn't need a signature. I just want to see whether they agree or disagree with the terms of the app. And then continue with the app if the user agrees. – troligtvis Jun 01 '15 at 20:35
  • This change is now in master. – jwe Jun 02 '15 at 22:10