ios - NSData 的文件路径

标签 ios cocoa nsdata

我有从文件路径加载的 NSData。然后数据被传递,我需要数据来源的文件路径。

除了将 filePath 作为额外参数传递之外,最简单的方法是什么?

最佳答案

将两者包装在代表文件的容器对象中,例如

@interface File : NSObject

@property (strong) NSData *fileContents;
@property (copy) NSString *filePath;

// perhaps, even a nice constructor to fill these properties
- (id)initWithFilePath:(NSString *)filePath;

@end

关于ios - NSData 的文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10272624/

相关文章:

ios - 带有 cocoapods 的 FlurrySDK

macos - 是否可以找到 MAC OSX 应用程序中使用的字体的文件路径

ios - 从 NSDataAsset 读取时偶尔崩溃

swift - 快速转换字符串 unicode 8

php - 将 zip 文件从 ios 应用程序发送到 php 服务器

ios - 在 float 格式的数字中每三位添加逗号

ios - 如何在添加到 UIViewController 的 tableView 上使用 UIScrollViewDelegate 方法?

ios - UITableview contentoffset 有时不起作用

objective-c - 单个 View 中的两个 NSTableView

c++ - pthreads:在主线程上执行功能