我正在使用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。这似乎是一个特定于案例的问题,因为对其他问题的回答在这种情况下没有帮助。
发布于 2018-06-13 03:07:58
替换这个
let _: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]使用
let consentSectionType: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]https://stackoverflow.com/questions/50824127
复制相似问题