在Info.plist里添加一行配置信息即可
设置Application supports iTunes file sharing为YES.
以下是返回该目录下文件路径的代码:
-(NSString*)shareFilePath:(NSString*)filePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent: filePath];
}
执行方法[xxx shareFilePath:@"Data.Index"]即可返回该目录下Data.Index的绝对路径。