将PDF文件插入Core Data? [英] Insert a PDF file into Core Data?
本文介绍了将PDF文件插入Core Data?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用我的应用程式汇入部分PDF档案。
但是我试图在我的数据库中插入我的PDF文件。我使用Core Data。有可能做到这一点吗?如果是,我该怎么办呢?我必须使用哪种类型(NSData,NSDocument,...?)
I'm using my app to import some PDF files. But I'm trying to insert my PDF file int my database. I'm using Core Data. Is it possible to do this ? If it is, how can I do it ? Which kind of types I have to use (NSData, NSDocument, ... ?)
非常感谢你! :)
推荐答案
要存储PDF(或真的任何大数据blob):
To store a PDF (or really any big data blob):
- 对于属性使用Core Data二进制类型,对应于
NSData
。 - 在您的核心数据模型中,为属性启用允许外部存储,以便Core Data可以在永久存储外部存储数据。
通常最好将PDF写入文件,并将文件名存储在持久存储中,而不是整个文件。
It's often better to just write the PDF to a file, and store the filename in your persistent store instead of the whole file.
这篇关于将PDF文件插入Core Data?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文