I'm getting this error dyld: Symbol not found: _OBJC_CLASS_$_CLKFullColorImageProvider
in watchOS 4 but not in watchOS 5, I believe it's related to my complication code below but can't figure out why...as far as I can tell the compiler shouldn't be looking for CLKFullColorImageProvider
as I've blocked that off with if #available(watchOSApplicationExtension 5.0, *)
class Complication: NSObject, CLKComplicationDataSource {
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
if #available(watchOSApplicationExtension 5.0, *) {
if complication.family == .circularSmall {
let template = CLKComplicationTemplateCircularSmallRingImage()
guard let image = UIImage(named: "Circular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .utilitarianSmall {
let template = CLKComplicationTemplateUtilitarianSmallRingImage()
guard let image = UIImage(named: "Utilitarian") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "Modular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .graphicCircular {
let template = CLKComplicationTemplateGraphicCircularImage()
guard let image = UIImage(named: "GraphicCircular") else { handler(nil); return}
template.imageProvider = CLKFullColorImageProvider(fullColorImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .graphicBezel {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "GraphicBezel") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .graphicCorner {
let template = CLKComplicationTemplateGraphicCornerCircularImage()
guard let image = UIImage(named: "GraphicCorner") else { handler(nil); return}
template.imageProvider = CLKFullColorImageProvider(fullColorImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else {
handler(nil)
}
} else {
if complication.family == .circularSmall {
let template = CLKComplicationTemplateCircularSmallRingImage()
guard let image = UIImage(named: "Circular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .utilitarianSmall {
let template = CLKComplicationTemplateUtilitarianSmallRingImage()
guard let image = UIImage(named: "Utilitarian") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "Modular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
handler(timelineEntry)
} else {
handler(nil)
}
}
}
func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) {
handler([])
}
func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
if #available(watchOSApplicationExtension 5.0, *) {
if complication.family == .circularSmall {
let template = CLKComplicationTemplateCircularSmallRingImage()
guard let image = UIImage(named: "Circular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .utilitarianSmall {
let template = CLKComplicationTemplateUtilitarianSmallRingImage()
guard let image = UIImage(named: "Utilitarian") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "Modular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .graphicCircular {
let template = CLKComplicationTemplateGraphicCircularImage()
guard let image = UIImage(named: "GraphicCircular") else { handler(nil); return}
template.imageProvider = CLKFullColorImageProvider(fullColorImage: image)
handler(template)
} else if complication.family == .graphicBezel {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "GraphicBezel") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .graphicCorner {
let template = CLKComplicationTemplateGraphicCornerCircularImage()
guard let image = UIImage(named: "GraphicCorner") else { handler(nil); return}
template.imageProvider = CLKFullColorImageProvider(fullColorImage: image)
handler(template)
} else {
handler(nil)
}
} else {
if complication.family == .circularSmall {
let template = CLKComplicationTemplateCircularSmallRingImage()
guard let image = UIImage(named: "Circular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .utilitarianSmall {
let template = CLKComplicationTemplateUtilitarianSmallRingImage()
guard let image = UIImage(named: "Utilitarian") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingImage()
guard let image = UIImage(named: "Modular") else { handler(nil); return}
template.imageProvider = CLKImageProvider(onePieceImage: image)
handler(template)
} else {
handler(nil)
}
}
}
}