为什么最后返回的结果是nil呢?

解决方案 »

  1.   

    试试[[NSBundle mainBundle] pathForResource:nameString ofType:typeString inDirectory:folderString]
    另外就算获取到值,也是要拷贝到documents里操作,resource里的东西是read-only的。
      

  2.   

    NSBundle *bundle = [ NSBundle mainBundle ];
    NSString *strDbFile = [ bundle pathForResource:@"demo" ofType:@"db" ];问题,就这样用的。你的数据库文件是不是没有添加到项目中去?
      

  3.   

    选中你的db,看右边的Target Membership有没有选中对应的Target