Reputation: 43
I'm building an app using ResearchKit through the Ray Wenderlich tutorial and the following code continues to give the error message: Use of unresolved identifier 'consentSectionType'
which is the current one. Since I didn't write the code, I'm not sure what's wrong with it, and I don't know how to fix it. This is the code:
public var ConsentDocument: ORKConsentDocument {
let consentDocument = ORKConsentDocument()
consentDocument.title = "Consent"
let _: [ORKConsentSectionType] = [
.overview,
.dataGathering,
.privacy,
.dataUse,
.timeCommitment,
.studySurvey,
.studyTasks,
.withdrawing
]
var consentSections: [ORKConsentSection] = consentSectionType.map { contentSectionType in
let consentSection = ORKConsentSection(type: contentSectionType)
consentSection.summary = "x."
consentSection.content = "y."
return consentSection
}
consentDocument.sections = consentSections
Occasionally Xcode will suggest that I change consentSectionType.map
to ORKConsentSection.map
, but that just brings another error message that says Type 'ORKConsentSection.map' has no member map
. This seems to be a case specific problem, as answers to the other questions weren't helpful in this case.
Upvotes: 1
Views: 1401
Reputation: 100503
Replace this
let _: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]
with
let consentSectionType: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]
Upvotes: 1