Swift &引用;未解析标识符的使用“;ResearchKit代码错误
我正在通过Ray Wenderlich教程使用ResearchKit构建一个应用程序,下面的代码继续给出错误消息:Swift &引用;未解析标识符的使用“;ResearchKit代码错误,swift,researchkit,xcode9.4,Swift,Researchkit,Xcode9.4,我正在通过Ray Wenderlich教程使用ResearchKit构建一个应用程序,下面的代码继续给出错误消息:使用未解析标识符'ApprovementSectionType',这是当前的标识符。由于我没有编写代码,我不确定它出了什么问题,也不知道如何修复它。代码如下: public var ConsentDocument: ORKConsentDocument { let consentDocument = ORKConsentDocument() consentDocument.titl
使用未解析标识符'ApprovementSectionType'
,这是当前的标识符。由于我没有编写代码,我不确定它出了什么问题,也不知道如何修复它。代码如下:
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会建议我将orkApproveSection.map
更改为orkApproveSection.map
,但这只会带来另一条错误消息,即类型“orkApproveSection.map”没有成员映射。这似乎是一个具体案例的问题,因为其他问题的答案在本案例中没有帮助 更换这个
let _: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]
与
返回了错误消息。还是不知道该怎么办,但是谢谢你!如果你是说这篇教程很老,你可以读这篇文章,我一直在寻找一篇更新的,这篇看起来很棒。谢谢
let consentSectionType: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]