我翻譯的Objective-C代碼斯威夫特3,當我寫這篇文章的代碼斯威夫特URL resourceSpecifier不可用
let url = URL(string:"http://example.com/index.html")
var formattedURL:String = url!.resourceSpecifier
我得到一個錯誤「‘resourceSpecifier’不可用:使用path
,query
和fragment
相反「。我該如何解決這個問題?
我翻譯的Objective-C代碼斯威夫特3,當我寫這篇文章的代碼斯威夫特URL resourceSpecifier不可用
let url = URL(string:"http://example.com/index.html")
var formattedURL:String = url!.resourceSpecifier
我得到一個錯誤「‘resourceSpecifier’不可用:使用path
,query
和fragment
相反「。我該如何解決這個問題?
'resourceSpecifier'是NSURL'的'屬性。雖然通常你在Swift 3中使用'URL',你仍然可以使用'NSURL'。 – rmaddy
什麼是URL中resourceSpecifier的等價物? –
沒有一個,這是問題。你可以剝離計劃和冒號來獲得相同的結果。 – rmaddy