久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用新的外部存儲標志將 UIImage 存儲在核心數據

Storing UIImage in Core Data with the new External Storage flag(使用新的外部存儲標志將 UIImage 存儲在核心數據中)
本文介紹了使用新的外部存儲標志將 UIImage 存儲在核心數據中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我知道 UIImage 在核心數據中的存儲已經討論了很多,例如 這里,但那是 ios5 之前的版本.現在我們有了外部存儲標志,你們認為將 UIImage 直接存儲在實體中、作為單獨的實體還是仍然在磁盤上是一個好主意?

這里是解釋外部存儲選項的來源.

解決方案

iOS 5.0 核心數據發布說明

<塊引用>

啟用后,Core Data 會啟發式地根據每個值決定是否它應該將數據直接保存在數據庫中或將 URI 存儲到它為您管理的單獨文件.您不能根據如果使用此選項,則為二進制數據屬性的內容.

從您的鏈接 外部二進制數據,啟發式似乎是

<塊引用>

小于 1MB 的對象存儲在數據庫中.為了更大的對象,創建一個外部文件和數據庫只是存儲對它的引用.

所以以下建議仍然有效:CoreData : store是否將圖像轉入數據庫?

<塊引用>
  • <100kb 與相關數據存儲在同一個表中
  • <1mb 存儲在通過關系附加的單獨表中,以避免不必要地加載
  • <塊引用>

    1mb 存儲在磁盤上并在 Core Data 中引用它

該標志設置 Core Data 遵循該建議并自動將 >1MB 的圖像存儲為單獨的磁盤文件.

I know that the storing of UIImage's in core data has been discussed a lot, such as here, but that was pre-ios5. Now that we have the external storage flag, do you guys think it would be a fine idea to store UIImage's directly in the entity, as a separate entity, or still on the disk?

Here is a source explaining the external storage option.

解決方案

Core Data Release Notes for iOS 5.0

When enabled, Core Data heuristically decides on a per-value basis if it should save the data directly in the database or store a URI to a separate file which it manages for you. You cannot query based on the contents of a binary data property if you use this option.

And from your link External Binary Data, the heuristic seems to be

Objects that are smaller than 1MB are stored in the database. For objects that are larger, an external file is created and the database just stores a reference to it.

So the following advice is still valid: CoreData : store images to DB or not?

  • < 100kb store in the same table as the relevant data
  • < 1mb store in a separate table attached via a relationship to avoid loading unnecessarily
  • 1mb store on disk and reference it inside of Core Data

The flag sets Core Data to follow that advice and automatically store images >1MB as a separate disk file.

這篇關于使用新的外部存儲標志將 UIImage 存儲在核心數據中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText with SpannableStringBuilder and ImageSpan doesn#39;t works fine(帶有 SpannableStringBuilder 和 ImageSpan 的 EditText 不能正常工作)
Align ImageView with EditText horizontally(將 ImageView 與 EditText 水平對齊)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
Having trouble creating UIImage from CIImage in iOS5(在 iOS5 中從 CIImage 創建 UIImage 時遇到問題)
Get list of all photo albums and thumbnails for each album(獲取所有相冊的列表和每個相冊的縮略圖)
Can anybody help me in recording iPhone output sound through Audio Unit(誰能幫我通過音頻單元錄制 iPhone 輸出的聲音)
主站蜘蛛池模板: 久久久成人免费一区二区 | 亚洲精品一区二区三区丝袜 | 日韩在线观看一区 | 精品国产一区二区三区观看不卡 | 欧美精品在线观看 | 精品日韩在线观看 | 99久久久久久久 | 又黑又粗又长的欧美一区 | 国产精品久久免费观看 | 国产精品一区二区在线播放 | 日本精品一区 | 国产精久久久 | 国内自拍偷拍 | 人和拘一级毛片c | 精品国产一区二区三区性色av | 国产福利视频导航 | 97色在线观看免费视频 | 99re视频这里只有精品 | 一区精品视频 | 91亚洲精选| 农村妇女毛片精品久久久 | 日本在线观看网址 | 国产大片一区 | 九九九久久国产免费 | 日韩av第一页 | 国产精品美女www爽爽爽 | 久久青| 人妖一区 | 精品国产18久久久久久二百 | 国际精品久久 | 狠狠狠干 | 欧美一级片 | 国产91精品在线 | 国产精品美女一区二区 | 91免费看片| av电影一区二区 | 精品国产一区二区三区日日嗨 | 在线一区| 国产亚洲成av人片在线观看桃 | 国产成人在线一区二区 | 日韩午夜影院 |