Mapbox:如何设置图层';s使用MGL_匹配表达式填充颜色

Mapbox:如何设置图层';s使用MGL_匹配表达式填充颜色,mapbox,mapbox-ios,Mapbox,Mapbox Ios,我试图使用MGL_匹配表达式设置Mapbox贴图层中各个要素的填充颜色,但我一直得到: ***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFString mgl\u color]:已将无法识别的选择器发送到实例 func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) { let layer = mapView.style!.layer(withIdentif

我试图使用MGL_匹配表达式设置Mapbox贴图层中各个要素的填充颜色,但我一直得到:

***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFString mgl\u color]:已将无法识别的选择器发送到实例

func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
        let layer = mapView.style!.layer(withIdentifier: "powiaty-1") as! MGLFillStyleLayer
        let source = mapView.style!.source(withIdentifier: "composite") as! MGLVectorTileSource
        let features = source.features(sourceLayerIdentifiers: NSSet(object: "powiaty") as! Set<String>, predicate: nil);
        let query = NSMutableString(format: "MGL_MATCH(jpt_kod_je, ");
        for feature in features {
            let code = feature.attribute(forKey: "jpt_kod_je") as! String
            let color = code.prefix(2) == "06" ? UIColor.red : UIColor.white;
            query.appendFormat("%@, %@, ", code, color)
        }
        query.appendFormat("%@)", UIColor.white);
        print(query);
        layer.fillColor = NSExpression(format: "%@", query);
    }
Crash with the stack:
0   CoreFoundation                      0x0000000106f456fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x00000001064e9ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000106f63ab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x0000000106f4a443 ___forwarding___ + 1443
    4   CoreFoundation                      0x0000000106f4c238 _CF_forwarding_prep_0 + 120
    5   Mapbox                              0x000000010575d629 _ZN24MGLStyleValueTransformerIN4mbgl5ColorEU8__strongP7UIColorS1_S4_E15toPropertyValueINS0_5style13PropertyValueIS1_EEEENSt3__19enable_ifIXntsr3std7is_sameIT_NS7_22ColorRampPropertyValueEEE5valueESC_E4typeEP12NSExpressionb + 257
    6   Mapbox                              0x000000010582845e -[MGLFillStyleLayer setFillColor:] + 123
    7   MapboxExpressions                   0x0000000105443eb3 $s17MapboxExpressions14ViewControllerC03mapC19DidFinishLoadingMapyySo06MGLMapC0CF + 4867 ...