2

I have an NSURL inside a NSDictionary, which looks like this:

assets-library://asset/asset.JPG?id=1000000001&ext=JPG

This NSURL is from UIImagePickerControllerReferenceURL. Without this object, the NSDictionary saves using this code fine:

BOOL success = [dictionary writeToFile:vaultPath atomically:YES];

But when I add the object to the NSDictionary, the writeToFile line returns NO.

Is there a problem with writeToFile and NSURLs, or is it because of this particular URL?

EDIT: Upon further examination, if i save this NSURL as an NSString instead, with the same data, it still fails.

Andrew
  • 15,489
  • 25
  • 116
  • 200

1 Answers1

7

From the docs for writeToFile:atomically:

This method recursively validates that all the contained objects are property list objects (instances of NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary) before writing out the file, and returns NO if all the objects are not property list objects, since the resultant file would not be a valid property list.

Rob Napier
  • 250,948
  • 34
  • 393
  • 528