Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 手表故障导致dyld崩溃:未找到符号:_OBJC_CLASS_$_CLKFullColorImageProvider_Ios_Swift_Xcode_Apple Watch_Apple Watch Complication - Fatal编程技术网

Ios 手表故障导致dyld崩溃:未找到符号:_OBJC_CLASS_$_CLKFullColorImageProvider

Ios 手表故障导致dyld崩溃:未找到符号:_OBJC_CLASS_$_CLKFullColorImageProvider,ios,swift,xcode,apple-watch,apple-watch-complication,Ios,Swift,Xcode,Apple Watch,Apple Watch Complication,我在watchOS 4中发现此错误dyld:Symbol未找到:_OBJC_CLASS_$_CLKFullColorImageProvider,但在watchOS 5中未发现此错误,我相信这与我下面的复杂代码有关,但我不明白为什么…据我所知,编译器不应该寻找CLKFullColorImageProvider,因为我已经用if#available(watchOSApplicationExtension 5.0,*) 你和我同时遇到了这个问题。从本页: 将ClockKit.framework添加为

我在watchOS 4中发现此错误
dyld:Symbol未找到:_OBJC_CLASS_$_CLKFullColorImageProvider
,但在watchOS 5中未发现此错误,我相信这与我下面的复杂代码有关,但我不明白为什么…据我所知,编译器不应该寻找
CLKFullColorImageProvider
,因为我已经用
if#available(watchOSApplicationExtension 5.0,*)


你和我同时遇到了这个问题。从本页:


ClockKit.framework
添加为手表扩展的
linkbinary With Libraries
阶段中的可选项。这立刻解决了我的问题。

您和我同时遇到了这个问题。从本页:

ClockKit.framework
添加为手表扩展的
linkbinary With Libraries
阶段中的可选项。这立刻解决了我的问题

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)

            }
        }


    }







}