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'>

                            主站蜘蛛池模板: 丙烷/液氧/液氮气化器,丙烷/液氧/液氮汽化器-无锡舍勒能源科技有限公司 | 百度关键词优化_网站优化_SEO价格 - 云无限好排名 | 整合营销推广|营销网络推广公司|石家庄网站优化推广公司|智营销 好物生环保网、环保论坛 - 环保人的学习交流平台 | 电加热导热油炉-空气加热器-导热油加热器-翅片电加热管-科安达机械 | 软文世界-软文推广-软文营销-新闻稿发布-一站式软文自助发稿平台 | 北京网络营销推广_百度SEO搜索引擎优化公司_网站排名优化_谷歌SEO - 北京卓立海创信息技术有限公司 | 生物风-销售载体,基因,质粒,ATCC细胞,ATCC菌株等,欢迎购买-百风生物 | 澳洁干洗店加盟-洗衣店干洗连锁「澳洁干洗免费一对一贴心服务」 干洗加盟网-洗衣店品牌排行-干洗设备价格-干洗连锁加盟指南 | wika威卡压力表-wika压力变送器-德国wika代理-威卡总代-北京博朗宁科技 | 伸缩器_伸缩接头_传力接头-巩义市润达管道设备制造有限公司 | 护腰带生产厂家_磁石_医用_热压护腰_登山护膝_背姿矫正带_保健护具_医疗护具-衡水港盛 | 机构创新组合设计实验台_液压实验台_气动实训台-戴育教仪厂 | 铝合金风口-玻璃钢轴流风机-玻璃钢屋顶风机-德州东润空调设备有限公司 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 置顶式搅拌器-优莱博化学防爆冰箱-磁驱搅拌器-天津市布鲁克科技有限公司 | 冷柜风机-冰柜电机-罩极电机-外转子风机-EC直流电机厂家-杭州金久电器有限公司 | 成都软件开发_OA|ERP|CRM|管理系统定制开发_成都码邻蜀科技 | 天津市能谱科技有限公司-专业的红外光谱仪_红外测油仪_紫外测油仪_红外制样附件_傅里叶红外光谱技术生产服务厂商 | 电磁铁_推拉电磁铁_机械手电磁吸盘电磁铁厂家-广州思德隆电子公司 | 南昌旅行社_南昌国际旅行社_南昌国旅在线 | 空调风机,低噪声离心式通风机,不锈钢防爆风机,前倾皮带传动风机,后倾空调风机-山东捷风风机有限公司 | 上海办公室设计_办公楼,写字楼装修_办公室装修公司-匠御设计 | 生鲜配送系统-蔬菜食材配送管理系统-连锁餐饮订货配送软件-挪挪生鲜供应链管理软件 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | 诺冠气动元件,诺冠电磁阀,海隆防爆阀,norgren气缸-山东锦隆自动化科技有限公司 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 【孔氏陶粒】建筑回填陶粒-南京/合肥/武汉/郑州/重庆/成都/杭州陶粒厂家 | 上海小程序开发-小程序制作-上海小程序定制开发公司-微信商城小程序-上海咏熠 | 细沙回收机-尾矿干排脱水筛设备-泥石分离机-建筑垃圾分拣机厂家-青州冠诚重工机械有限公司 | 包装机传感器-搅拌站传感器-山东称重传感器厂家-济南泰钦电气 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 家庭教育吧-在线家庭教育平台,专注青少年家庭教育 | 新车测评网_网罗汽车评测资讯_汽车评测门户报道 | 合景一建-无尘车间设计施工_食品医药洁净车间工程装修总承包公司 | 搅拌磨|搅拌球磨机|循环磨|循环球磨机-无锡市少宏粉体科技有限公司 | 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | ET3000双钳形接地电阻测试仪_ZSR10A直流_SXJS-IV智能_SX-9000全自动油介质损耗测试仪-上海康登 | 【直乐】河北石家庄脊柱侧弯医院_治疗椎间盘突出哪家医院好_骨科脊柱外科专业医院_治疗抽动症/关节病骨伤权威医院|排行-直乐矫形中医医院 | 车间除尘设备,VOCs废气处理,工业涂装流水线,伸缩式喷漆房,自动喷砂房,沸石转轮浓缩吸附,机器人喷粉线-山东创杰智慧 | 低粘度纤维素|混凝土灌浆料|有机硅憎水粉|聚羧酸减水剂-南京斯泰宝 |