我有一个NSData,我正在从filePath加载.然后数据被传递,我需要filePath来获取数据的来源.
除了将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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1554 次 |
| 最近记录: |