Ambiguous reference to member OCKCarePlanActivity 'assessment

74 views Asked by At

Using Xcode 9.4, Swift 3 and CareKit framework 1.2.1 Error Message:

Ambiguous reference to member OCKCarePlanActivity 'assessment (withIdentifier:groupIdentifier:title:text:tintColor:resultResettable:schedule:userInfo:thresholds:optional:)'

Here is the code.

    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()]
)
1

There are 1 answers

0
JIANG On BEST ANSWER

Newer CareKit framework added Optional parameter.

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

This change fixed my error. Hope it will help others.