我正在通过 Ray Wenderlich 教程使用 ResearchKit 构建一个应用程序,以下代码继续给出错误消息:Use of unresolved identifier 'consentSectionType'
这是当前的。由于我没有编写代码,我不确定它有什么问题,也不知道如何修复它。这是代码:
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
有时 Xcode 会建议我更改consentSectionType.map
为ORKConsentSection.map
,但这只会带来另一条错误消息,上面写着Type 'ORKConsentSection.map' has no member map
. 这似乎是一个特定于案例的问题,因为在这种情况下对其他问题的回答没有帮助。