NSBundle pathForResource is NULL

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

    I was trying to get my iPhone app to use a default sqlite database and the darn app couldn't find it. Turned out that I had to make sure that the .sqlite file was in the bundle resource.

    1. Select your project
    2. Select Target
    3. Select Build Phases tab
    4. Open the section labelled "Copy Bundle Resources"
    5. Drag and drop your .sqlite file into this section.

    now your app will find this default sqlite database.

提交回复
热议问题