如何将 UIImage 对象的 NSArray 写入文件?
我一直在尝试使用 NSMutableArray 的 writeToFile:atomically:
但有人向我指出这种方法是错误的:即 iPhone / Objective-C:NSMutableArray writeToFile 不会写入文件。总是返回“否”
看来我必须阅读上述链接的答案之一中提到的存档指南。
有人愿意分享(或向我指出)一些可以帮助我完成这项任务的代码吗?
I have been attempting to use NSMutableArray's writeToFile:atomically:
But it has been pointed out to me that this approach is wrong: i.e. iPhone / Objective-C: NSMutableArray writeToFile won't write to file. Always returns NO
It looks like I'm going to have to read the guide on archiving that is referred to in one of the answers in the above link.
Would anyone care to share (or point me towards) some code that helps me accomplish this task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提到的方法在写出文件之前递归地验证所有包含的对象都是属性列表对象。
试试这个:
也许你可以使用
[UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPathatomically:YES];
将图像写入 jpeg。The method, you've mentioned recursively validates that all the contained objects are property list objects before writing out the file.
Try this:
Maybe you can use
[UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPath atomically:YES];
to write image as jpeg.