我尝试在swift-3.0.1版本的ubuntu-16.04上运行以下swift代码:
import Foundation
let a = NSMutableDictionary()
a.setObject("value",forKey:"key" as NScopying)
然后它给了我一个编译错误:
error: repl.swift:4:30: error: cannot convert value of type 'NSCopying' to
expected argument type 'AnyHashable'
a.setObject("a",forKey:"xxx" as! NSCopying)
~~~~~~^~~~~~~~~~~~~
as! AnyHashable
但是这段代码在MacOS上运行良好
我该怎么办?