In my iOS application I have made a form that should submit data into a plist. I have followed examples from this link amongst other -
Now the I think I have done everything right except I am getting one error and it is related to ARC - says Xcode - so I am not sure if the example I used is outdated or if I have just forgotten something.
To clarify - I have the save button with the appropriate -(IBAction) and it is giving no errors so i think I am ok there. the bit that needs tweaking I think is copying the original Data.plist into the document folder which I think I am suppose to achieve with this.
I have pasted the code where the error occurs below. Any help is great and if I can help by posting more code, let me know:-)
- (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];
}
Cheers Jeff
I just noticed I didn't clarify what is giving me the error:
it's this line
[fileManager copyItemAtPath:sourcePath toPath:destPath];
and the error is:
ARC Issue - No visible @interface for 'NSFileManager' declares the selector 'copyItemAtPath:toPath:'