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

<legend id='gtCpw'><style id='gtCpw'><dir id='gtCpw'><q id='gtCpw'></q></dir></style></legend>

<small id='gtCpw'></small><noframes id='gtCpw'>

    • <bdo id='gtCpw'></bdo><ul id='gtCpw'></ul>

    <tfoot id='gtCpw'></tfoot>
    1. <i id='gtCpw'><tr id='gtCpw'><dt id='gtCpw'><q id='gtCpw'><span id='gtCpw'><b id='gtCpw'><form id='gtCpw'><ins id='gtCpw'></ins><ul id='gtCpw'></ul><sub id='gtCpw'></sub></form><legend id='gtCpw'></legend><bdo id='gtCpw'><pre id='gtCpw'><center id='gtCpw'></center></pre></bdo></b><th id='gtCpw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gtCpw'><tfoot id='gtCpw'></tfoot><dl id='gtCpw'><fieldset id='gtCpw'></fieldset></dl></div>

        NSManagedObjectContext 的 performBlock: 是做什么用的?

        What is NSManagedObjectContext#39;s performBlock: used for?(NSManagedObjectContext 的 performBlock: 是做什么用的?)

        <small id='7zCD9'></small><noframes id='7zCD9'>

          <tfoot id='7zCD9'></tfoot>
              • <bdo id='7zCD9'></bdo><ul id='7zCD9'></ul>

              • <i id='7zCD9'><tr id='7zCD9'><dt id='7zCD9'><q id='7zCD9'><span id='7zCD9'><b id='7zCD9'><form id='7zCD9'><ins id='7zCD9'></ins><ul id='7zCD9'></ul><sub id='7zCD9'></sub></form><legend id='7zCD9'></legend><bdo id='7zCD9'><pre id='7zCD9'><center id='7zCD9'></center></pre></bdo></b><th id='7zCD9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7zCD9'><tfoot id='7zCD9'></tfoot><dl id='7zCD9'><fieldset id='7zCD9'></fieldset></dl></div>
                    <tbody id='7zCD9'></tbody>
                  <legend id='7zCD9'><style id='7zCD9'><dir id='7zCD9'><q id='7zCD9'></q></dir></style></legend>
                  本文介紹了NSManagedObjectContext 的 performBlock: 是做什么用的?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  在 iOS 5 中,NSManagedObjectContext 有幾個新方法,performBlock:performBlockAndWait:.這些方法實際上是用來做什么的?它們在舊版本中替換了什么?應該將什么樣的塊傳遞給他們?我如何決定使用哪個?如果有人有一些使用示例,那就太好了.

                  In iOS 5, NSManagedObjectContext has a couple of new methods, performBlock: and performBlockAndWait:. What are these methods actually used for? What do they replace in older versions? What kind of blocks are supposed to be passed to them? How do I decide which to use? If anyone has some examples of their use it would be great.

                  推薦答案

                  方法 performBlock:performBlockAndWait: 用于向您的 NSManagedObjectContext 實例,如果 MOC 是使用 NSPrivateQueueConcurrencyTypeNSMainQueueConcurrencyType 初始化的.如果您對這些上下文類型之一執行任何操作,例如設置持久存儲或保存更改,您可以在一個塊中執行.

                  The methods performBlock: and performBlockAndWait: are used to send messages to your NSManagedObjectContext instance if the MOC was initialized using NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType. If you do anything with one of these context types, such as setting the persistent store or saving changes, you do it in a block.

                  performBlock: 將塊添加到后備隊列并安排它在自己的線程上運行.該塊將立即返回.您可以將其用于對后備存儲的長期持久操作.

                  performBlock: will add the block to the backing queue and schedule it to run on its own thread. The block will return immediately. You might use this for long persist operations to the backing store.

                  performBlockAndWait: 還將塊添加到后備隊列并安排它在自己的線程上運行.但是,在塊執行完成之前,塊不會返回.如果您在知道操作是否成功之前無法繼續前進,那么這是您的選擇.

                  performBlockAndWait: will also add the block to the backing queue and schedule it to run on its own thread. However, the block will not return until the block is finished executing. If you can't move on until you know whether the operation was successful, then this is your choice.

                  例如:

                  __block NSError *error = nil;
                  [context performBlockAndWait:^{
                      myManagedData.field = @"Hello";
                      [context save:&error];
                  }];
                  
                  if (error) {
                      // handle the error.
                  }
                  

                  請注意,因為我做了一個 performBlockAndWait:,我可以訪問塊外的錯誤.performBlock: 需要不同的方法.

                  Note that because I did a performBlockAndWait:, I can access the error outside the block. performBlock: would require a different approach.

                  來自 iOS 5 核心數據發行說明:

                  NSManagedObjectContext 現在為并發操作提供結構化支持.當您使用 initWithConcurrencyType: 創建托管對象上下文時,您有三個選項用于其線程(隊列)關聯

                  NSManagedObjectContext now provides structured support for concurrent operations. When you create a managed object context using initWithConcurrencyType:, you have three options for its thread (queue) association

                  • 限制(NSConfinementConcurrencyType).

                  • Confinement (NSConfinementConcurrencyType).

                  這是默認設置.您保證上下文不會被除您創建它的線程之外的任何線程使用.(這與您在以前版本中使用的線程要求完全相同.)

                  This is the default. You promise that context will not be used by any thread other than the one on which you created it. (This is exactly the same threading requirement that you've used in previous releases.)

                  私有隊列(NSPrivateQueueConcurrencyType).

                  Private queue (NSPrivateQueueConcurrencyType).

                  上下文創建并管理一個私有隊列.在這里,上下文擁有隊列并為您管理所有細節,而不是您創建和管理與上下文相關聯的線程或隊列(前提是您使用如下所述的基于塊的方法).

                  The context creates and manages a private queue. Instead of you creating and managing a thread or queue with which a context is associated, here the context owns the queue and manages all the details for you (provided that you use the block-based methods as described below).

                  主隊列(NSMainQueueConcurrencyType).

                  Main queue (NSMainQueueConcurrencyType).

                  上下文與主隊列相關聯,因此與應用程序的事件循環相關聯,但在其他方面類似于私有的基于隊列的上下文.您將此隊列類型用于鏈接到控制器和 UI 對象的上下文,這些對象只需要在主線程上使用.

                  The context is associated with the main queue, and as such is tied into the application’s event loop, but it is otherwise similar to a private queue-based context. You use this queue type for contexts linked to controllers and UI objects that are required to be used only on the main thread.

                  這篇關于NSManagedObjectContext 的 performBlock: 是做什么用的?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                  To stop segue and show alert(停止 segue 并顯示警報)
                  iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                  Icon already includes gloss effects(圖標已經包含光澤效果)
                  How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                  UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))
                • <i id='PtYEh'><tr id='PtYEh'><dt id='PtYEh'><q id='PtYEh'><span id='PtYEh'><b id='PtYEh'><form id='PtYEh'><ins id='PtYEh'></ins><ul id='PtYEh'></ul><sub id='PtYEh'></sub></form><legend id='PtYEh'></legend><bdo id='PtYEh'><pre id='PtYEh'><center id='PtYEh'></center></pre></bdo></b><th id='PtYEh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PtYEh'><tfoot id='PtYEh'></tfoot><dl id='PtYEh'><fieldset id='PtYEh'></fieldset></dl></div>
                  <legend id='PtYEh'><style id='PtYEh'><dir id='PtYEh'><q id='PtYEh'></q></dir></style></legend>
                  • <bdo id='PtYEh'></bdo><ul id='PtYEh'></ul>
                            <tbody id='PtYEh'></tbody>
                        • <tfoot id='PtYEh'></tfoot>

                            <small id='PtYEh'></small><noframes id='PtYEh'>

                            主站蜘蛛池模板: 久久日韩粉嫩一区二区三区 | 国产精品一区二区三区在线 | 四虎影院新网址 | 日韩网站在线观看 | 亚洲国产免费 | 欧美日韩成人在线 | 亚洲一区二区三区在线 | 涩涩视频网站在线观看 | 91免费版在线观看 | 99re视频在线 | 欧美日韩视频一区二区 | 国产男女视频网站 | 999精品网 | 91在线视频免费观看 | 在线观看h视频 | 国产精品一区二区在线观看 | 成人乱人乱一区二区三区软件 | 国产福利一区二区 | 免费观看一级特黄欧美大片 | 在线观看免费观看在线91 | 国产欧美日韩综合精品一区二区 | 日韩亚洲欧美综合 | 性欧美hd| 欧美亚州综合 | 日韩一二三区视频 | 国产一级一级毛片 | 日本成人在线免费视频 | 1204国产成人精品视频 | 一区二区三区中文字幕 | 一级无毛片| 久久不卡 | 日韩视频在线一区 | 国产小视频在线 | 人人干人人舔 | 天堂色 | 成人一级视频在线观看 | 一区二区三区视频在线观看 | 久久久久网站 | 久久久91精品国产一区二区精品 | 午夜视频在线免费观看 | 人人插人人 |