Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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 参数标签';(1)及"x27 ;;不匹配任何可用重载-NSAttributedStringKey_Ios_Swift - Fatal编程技术网

Ios 参数标签';(1)及"x27 ;;不匹配任何可用重载-NSAttributedStringKey

Ios 参数标签';(1)及"x27 ;;不匹配任何可用重载-NSAttributedStringKey,ios,swift,Ios,Swift,我在Swift中获得以下代码 dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value) 代码是: func convertToAttribute(dictionary: [String: Any]?) -> [NSAttributedStringKey: Any]? { guard let dictionary = dictionary else { return nil } let convert

我在Swift中获得以下代码

dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value) 
代码是:

func convertToAttribute(dictionary: [String: Any]?) -> [NSAttributedStringKey: Any]? {
    guard let dictionary = dictionary else { return nil }

    let convertedAttributes = Dictionary(uniqueKeysWithValues:
        dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value) }
    )

    return convertedAttributes
}

有人能帮我摆脱这个问题吗

您使用的是什么版本的Xcode/Swift?您的代码适用于Xcode 9.4和Swift 4.1.2。是的。。我用的是swift 3…谢谢