NSBundle pathForResource is NULL

前端 未结 9 959
感情败类
感情败类 2020-11-29 04:41

I\'m creating a simple application with xcode and objc and I need to load an NSDictionary from a file, but I can\'t get the path to the file using NSBundle:

         


        
9条回答
  •  离开以前
    2020-11-29 05:10

    Is the file really included in the target (and will therefor be copied to the bundle) ? There two ways to find out/set that:

    First way: right-click (or Cmd-click) on the file, select "Get Info". Then click on the "Targets" tab and make sure the file is checked for the desired target(s).

    Second way: right-click (or Cmd-clock) in the project browser on the header of the file browser (it will likely read "Groups & Files"). Then select "Target Membership". Now you have checkboxes next to each file that can be member of a target (like .m files or resources). Again, make sure the checkbox next to your file is checked.

提交回复
热议问题