NSBundle.mainBundle().URLForResource(“bach1”, withExtension: “jpg”) returning null

后端 未结 5 671
执笔经年
执笔经年 2021-01-02 10:28
NSBundle.mainBundle().URLForResource(\"bach1\", withExtension: \"jpg\")

The above code is returning null.

In order to check if the file exi

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 10:42

    I found that you have to actually go into Build Phases -> Copy Bundle Resources and manually add your item sometimes to the bundle. In my case it was a video file that didn't get added to the bundle correctly on its own.

提交回复
热议问题