NSBundle pathForResource is NULL

前端 未结 9 964
感情败类
感情败类 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:07

    My problem and solution are very similar to Dmitriy Isaev's ones. I have tried to get path for a xib file. Both calls (in Swift) pathForResource("myfile", ofType: "xib") and pathForResource("myfile.xib", ofType: nil) are failed.

    The solution is to use extension "nib" instead:

    pathForResource("myfile", ofType: "nib")
    

提交回复
热议问题