[英]Swfit Data can not get value
您必須將路徑的文件類型指定為 json 作為
guard let jsonpath = bundle.main.path(forResource: "MainVCString", ofType: "json"),
這個怎么樣 ?
if let fileURL = Bundle.main.url(forResource: "MainVCString", withExtension: "json"){
if let data = try? Data(contentsOf: fileURL, options: Data.ReadingOptions.uncached){
print("This works!")
}else{
print("Something wrong with the path.")
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.