使用Xcode 9.4,Swift 3和CareKit框架1.2.1错误消息:
对成员OCKCarePlanActivity'评估的含糊不清(withIdentifier:groupIdentifier:title:text:tintColor:resultResettable:schedule:userInfo:thresholds:optional:)'
这是代码。
let pulseActivity = OCKCarePlanActivity
.assessment(withIdentifier: ActivityIdentifier.pulse.rawValue,
groupIdentifier: nil,
title: "Pulse",
text: "Do you have one?",
tintColor: UIColor.darkGreen(),
resultResettable: true,
schedule: CarePlanData.dailyScheduleRepeating(occurencesPerDay: 1),
userInfo: ["ORKTask": AssessmentTaskFactory.makePulseAssessmentTask()]
)
答案 0 :(得分:0)
新的CareKit框架添加了Optional参数。
let pulseActivity = OCKCarePlanActivity
.assessment(withIdentifier: ActivityIdentifier.pulse.rawValue,
groupIdentifier: nil,
title: "Pulse",
text: "Do you have one?",
tintColor: UIColor.darkGreen(),
resultResettable: true,
schedule: CarePlanData.dailyScheduleRepeating(occurencesPerDay: 1),
userInfo: ["ORKTask": AssessmentTaskFactory.makePulseAssessmentTask()],
optional: true) //--> NEW
此更改解决了我的错误。希望对别人有帮助。