How can I retain CGPDFDictionaryRef?

隐身守侯 提交于 2019-12-08 12:00:34

问题


Any ideas how to "retain" CGPDFDictionaryRef? CFRetain not working, but there must be way to "retain" it.


回答1:


From the documentation

This opaque type is not derived from CFType and therefore there are no functions for retaining and releasing it. CGPDFDictionary objects exist only as constituent parts of a CGPDFDocument object, and they are managed by their container.




回答2:


A CGPDFDictionaryRef is just a pointer to a struct. Thus, you can easily retain it when boxed into a NSValue.

Of course the object parent container (CGPDFDocument and CGPDFPage) need to be kept in memory or the pointers within the struct will go invalid.



来源:https://stackoverflow.com/questions/4159448/how-can-i-retain-cgpdfdictionaryref

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!