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

后端 未结 5 673
执笔经年
执笔经年 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条回答
  •  鱼传尺愫
    2021-01-02 10:53

    I had this issue too. My fix was:

    • Selecting the file in project navigator
    • Open the 'File Inspector' (on the right hand side pane)
    • Checking the app target in the Target Membership

提交回复
热议问题