How can I retrieve local files with NSURL?

前端 未结 3 2012
独厮守ぢ
独厮守ぢ 2020-12-16 10:48

I\'m here with a question that probably has a really simple answer that I am overlooking... how can I retrieve local files with NSURL? I have this here:

over         


        
3条回答
  •  北海茫月
    2020-12-16 11:25

    You should use URLForResource(_:withExtension:) instead of pathForResource:

    let fileUrl = Bundle.main.url(forResource: "bpreg", withExtension: "xml")
    

提交回复
热议问题