开发者

writeToFile not working on NSDictionary with UIImagePickerControllerReferenceURL inside

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 w开发者_运维知识库ith 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜