【发布时间】:2010-05-20 04:53:55
【问题描述】:
我的数组数组...我尝试通过缓冲文件中的数组以供以后重用来提高我的应用程序性能。
我有一个 NSMutableArray,它包含大约 30 个带有 NSNumber、NSDate 和 NSString 对象的 NSMutableArray。
我尝试使用此调用写入文件:
bool result = [myArray writeToFile:[fileMethods
getFullPath:[NSString
stringWithFormat:@"iEts%@.arr",
[aDate shortDateString]]]
atomically:NO];
=> 结果 = FALSE。
Path方法是:
+ (NSString *) getFullPath:(NSString *)forFileName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:forFileName];
}
并且 aDate 调用返回一个带有 ddMMyy 的 shortDateString。
NSLog
NSLog(@"%@", [fileMethods getFullPath:[NSString stringWithFormat:@"iEts%@.arr",
[aDate shortDateString]]]);
关于路径生成返回:
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/86729620-EC1D-4C10-A799-0C638BB27933/Documents/iEts010510.arr
进一步:
- 它一定与 数组数组,因为我也写了 3 更简单的数组(包含 NSStrings) 都成功了。
- 使用 addObject 方法生成数组数组
有什么可能导致问题的想法吗?
【问题讨论】:
标签: iphone objective-c xcode