本帖最后由 bluebohe 于 2012-01-18 01:13:45 编辑

解决方案 »

  1.   

    给lz提供一个我程序里面的例子吧// 获得app的documnet目录
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSString *realPath = [documentPath stringByAppendingPathComponent:@"fanmeli.sqlite"];
    //   程序里面的文件目录
    NSString *sourcePath = [[NSBundle mainBundle] pathForResource:@"fanmeli" ofType:@"sqlite"];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    // 判断拷贝路径
    if (![fileManager fileExistsAtPath:realPath]) {
    NSError *error;
    if (![fileManager copyItemAtPath:sourcePath toPath:realPath error:&error]) {
    NSLog(@"%@",[error localizedDescription]);
    }
    }
      

  2.   

    不知道我理解的对不对,我感觉lZ没有搞清楚 沙盒 的概念
    ……
    如果是资源类的文件,直接当资源文件处理就可以了。
    如果文件在App运行时才由沙盒外传进来就麻烦一点,需要借助iCloud、iTunes、webserver等
      

  3.   

    你把文件拖到ios模拟器的屏幕上 就能看到文件的路径了
    这个路径就可以在你的代码中访问