pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<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="37vzlvv" 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="hbnpjxj" 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 初始化的.如果您對這些上下文類型之一執(zhí)行任何操作,例如設置持久存儲或保存更改,您可以在一個塊中執(zhí)行.

                  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: 還將塊添加到后備隊列并安排它在自己的線程上運行.但是,在塊執(zhí)行完成之前,塊不會返回.如果您在知道操作是否成功之前無法繼續(xù)前進,那么這是您的選擇.

                  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 核心數(shù)據(jù)發(fā)行說明:

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

                  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).

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

                  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).

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

                  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).

                  上下文與主隊列相關聯(lián),因此與應用程序的事件循環(huán)相關聯(lián),但在其他方面類似于私有的基于隊列的上下文.您將此隊列類型用于鏈接到控制器和 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模板網(wǎng)!

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

                  相關文檔推薦

                  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(圖標已經(jīng)包含光澤效果)
                  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="t7pvrtt" 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'>

                            主站蜘蛛池模板: 云南外加剂,云南速凝剂,云南外加剂代加工-普洱澜湄新材料科技有限公司 | 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 液压中心架,数控中心架,自定心中心架-烟台恒阳机电设计有限公司 行星搅拌机,双行星搅拌机,动力混合机,无锡米克斯行星搅拌机生产厂家 | 涿州网站建设_网站设计_网站制作_做网站_固安良言多米网络公司 | 河南新乡德诚生产厂家主营震动筛,振动筛设备,筛机,塑料震动筛选机 | 上海办公室装修,办公楼装修设计,办公空间设计,企业展厅设计_写艺装饰公司 | 振动时效_振动时效仪_超声波冲击设备-济南驰奥机电设备有限公司 北京宣传片拍摄_产品宣传片拍摄_宣传片制作公司-现像传媒 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 低温等离子清洗机(双气路进口)-嘉润万丰 | UV-1800紫外光度计-紫外可见光度计厂家-翱艺仪器(上海)有限公司 | RTO换向阀_VOC高温阀门_加热炉切断阀_双偏心软密封蝶阀_煤气蝶阀_提升阀-湖北霍科德阀门有限公司 | 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 湖南自考_湖南自学考试| 仿古建筑设计-仿古建筑施工-仿古建筑公司-汉匠古建筑设计院 | 瑞典Blueair空气净化器租赁服务中心-专注新装修办公室除醛去异味服务! | CNC机加工-数控加工-精密零件加工-ISO认证厂家-鑫创盟 | 定硫仪,量热仪,工业分析仪,马弗炉,煤炭化验设备厂家,煤质化验仪器,焦炭化验设备鹤壁大德煤质工业分析仪,氟氯测定仪 | 光环国际-新三板公司_股票代码:838504 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 | 铜镍-康铜-锰铜-电阻合金-NC003 - 杭州兴宇合金有限公司 | 铝镁锰板_铝镁锰合金板_铝镁锰板厂家_铝镁锰金属屋面板_安徽建科 | 亮点云建站-网站建设制作平台 | 车牌识别道闸_停车场收费系统_人脸识别考勤机_速通门闸机_充电桩厂家_中全清茂官网 | 全屋整木定制-橱柜,家具定制-四川峨眉山龙马木业有限公司 | 山东彩钢板房,山东彩钢活动房,临沂彩钢房-临沂市贵通钢结构工程有限公司 | 英国公司注册-新加坡公司注册-香港公司开户-离岸公司账户-杭州商标注册-杭州优创企业 | 蜜蜂职场文库_职场求职面试实用的范文资料大全 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 线粒体膜电位荧光探针-细胞膜-标记二抗-上海复申生物科技有限公司 | 耐酸碱胶管_耐腐蚀软管总成_化学品输送软管_漯河利通液压科技耐油耐磨喷砂软管|耐腐蚀化学软管 | 捷码低代码平台 - 3D数字孪生_大数据可视化开发平台「免费体验」 | 万家财经_财经新闻_在线财经资讯网| Q361F全焊接球阀,200X减压稳压阀,ZJHP气动单座调节阀-上海戎钛 | 物流公司电话|附近物流公司电话上门取货 | 西点培训学校_法式西点培训班_西点师培训_西点蛋糕培训-广州烘趣西点烘焙培训学院 | 精密模具加工制造 - 富东懿 | 广州展览制作|展台制作工厂|展览设计制作|展览展示制作|搭建制作公司 | 水质传感器_水质监测站_雨量监测站_水文监测站-山东水境传感科技有限公司 | 航拍_专业的无人机航拍摄影门户社区网站_航拍网 | 依维柯自动挡房车,自行式国产改装房车,小型房车价格,中国十大房车品牌_南京拓锐斯特房车 - 南京拓锐斯特房车 | 淄博不锈钢,淄博不锈钢管,淄博不锈钢板-山东振远合金科技有限公司 |