Copy file contents

Hello,

I’m trying to create an “empty dictionary” somewhere on disk. If I create an empty file and then use NSDictionary dictionaryWithContentsOfFile, it won’t work – the dictionary returns (null).

There seems to be a minimal contents for an “empty” dictionary, that is:

So I created an “empty dictionary” into my main bundle. I want to copy the content of this file into a newly created file (the path is known). What’s the best way to do it?

Thanks.

NSDictionary *dict = [NSDictionary dictionary];
[dict writeToFile:@“/Users/shane/Desktop/A test.plist” atomically:YES];

Thank you, Shane.

I forgot that writeToFile creates the file, I was using the default manager to create it, maybe it’s why it didn’t work.

Regards,