在我的iOS应用程序中,我制作了一个表单,应该将数据提交给plist。我按照例子从这个链接除其他 -将文件添加到我的Plist中 - 我想我差不多有
现在我认为我所做的一切都是正确的,除了我得到一个错误,它关系到ARC - 说的Xcode - 所以我不知道如果示例我用过时了,或者我忘记了一些东西。为了说明 - 我有保存按钮与相应的 - (IBAction),它没有给出任何错误,所以我认为我在那里确定。我认为需要调整的位是将原始Data.plist复制到文档文件夹中,我认为我应该用这个文件夹来实现。
我粘贴了下面的错误发生的代码。任何帮助是巨大的,如果我可以通过发布更多的代码帮助,让我知道:-)
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *destPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
destPath = [destPath stringByAppendingPathComponent:@"Data.plist"];
// If the file doesn't exist in the Documents Folder, copy it.
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:destPath]) {
NSString *sourcePath = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
[fileManager copyItemAtPath:sourcePath toPath:destPath];
}
// Load the Property List.
savedReadingsDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:destPath];
}
干杯杰夫
我只注意到我没有澄清什么是给我的错误:
这是该行
[fileManager copyItemAtPath:sourcePath toPath:destPath];
和错误是:
ARC Issue - No visible @interface for 'NSFileManager' declares the selector 'copyItemAtPath:toPath:'
似乎摆脱了错误谢谢 - 没有调试为什么我得到的NSDictionary问题 - 谢谢:-) – 2012-03-26 09:12:38
没有问题的人!下个问题祝你好运! – tipycalFlow 2012-03-26 11:44:30