草庐IT

dispatch_apply

全部标签

ios - 使用 performBackgroundTask 将多个核心数据插入分派(dispatch)到 NSPersistentContainer 时合并冲突

我正在试验新的核心数据APINSPersistentContainer,我的印象是内部排队机制会阻止写入事务并发评估,详见堆栈溢出答案NSPersistentContainerconcurrencyforsavingtocoredataThewaythatalotofproshavebeendealingwiththeproblemforalongtime(evenbeforeNSPersistentContainerdidit)wastohaveanoperationqueuetoqueuethewritessothereisonlyonewritegoingonatatime,an

ios - 在 Swift 中,如何从 dispatch_time_t 获取 NSDate?

“Walltime”是GrandCentralDispatch使用的一种鲜为人知的时间格式。苹果在这里谈论它:https://developer.apple.com/library/ios/documentation/Performance/Reference/GCD_libdispatch_Ref/虽然有些事情确实很方便,但它是一个粘性wicket。很难让它与其他时间格式兼容,这就是我的问题所在。我可以通过将NSDate转换为timespec来制作walltime,然后使用dispatch_walltime:letnow=NSDate().timeIntervalSince1970l

swift - swift 3.0 中的 dispatch_group_async 函数

我的问题是如何在Swift3中正确翻译此函数,因为我注意到有很多关于dispatch_async的文档,但没有任何关于dispatch_group_async的文档>dispatch_group_async(group,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0)){[unownedself]in 最佳答案 试试这个:letgroup=DispatchGroup()DispatchQueue.global(qos:.userInitiated).async(group:g

ios - swift 中的 dispatch_block_t 相当于什么?

我有一些我想理解的objective-c代码,以便在swift中执行相同的操作:dispatch_block_tadjustTooltipVisibility=^{self.tooltipView.alpha=_tooltipVisible?1.0:0.0;self.tooltipTipView.alpha=_tooltipVisible?1.0:0.0;};到目前为止,关于dispatch_block_t我能找到的所有信息是它在swift的dispatch_after中用作闭包。所以我能理解,但我不明白它在objective-c中的用法,以及如何将这段代码转换为swift代码

swift - iOS 8 : Applying a UIVisualEffectView with Blur Effect to a Modal PopOver in Compact Mode

我正在尝试制作一个类似于2014年WWDC第214次session中的弹出窗口。因此,我开始使用IB构建我的应用程序,该IB具有通过“PresentAsPopover”segue连接的两个View,如下所示:弹出View包含一个填充其父View的TextView,具有以下约束:为了支持模态弹出框,代码如下:funcadaptivePresentationStyleForPresentationController(controller:UIPresentationController)->UIModalPresentationStyle{return.OverFullScreen}fu

ios - 具有父类(super class)和子类的 Swift 协议(protocol)扩展方法分派(dispatch)

我发现了一个有趣的行为,它看起来像是一个错误......基于以下文章描述的行为:https://medium.com/ios-os-x-development/swift-protocol-extension-method-dispatch-6a6bf270ba94http://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future当我添加SomeSuperclass而不是直接采用协议(protocol)时,输出不是我所期望的。protocolTheProtocol{funcmethod1()}extensionTheProtocol{

ios - swift ,dispatch_group_wait 不等待

我正在尝试使用grandcentraldispatch来等待文件完成下载,然后再继续。这个问题是这个问题的衍生问题:Swift(iOS),waitingforallimagestofinishdownloadingbeforereturning.我只是想找出如何让dispatch_group_wait(或类似的)真正等待,而不是在下载完成之前继续。请注意,如果我使用NSThread.sleepForTimeInterval而不是调用downloadImage,它会等待得很好。我错过了什么?classImageDownloader{varupdateResult=AdUpdateResu

Handler dispatch failed; nested exception is java.lang.StackOverflowError

编写crm项目时浏览器上,出现" Handlerdispatchfailed;nestedexceptionisjava.lang.StackOverflowError"错误typeExceptionreportmessageHandlerdispatchfailed;nestedexceptionisjava.lang.StackOverflowErrordescriptionTheserverencounteredaninternalerrorthatpreventeditfromfulfillingthisrequest.出现StackOverflowError问题可以检查一下servi

Java Graphics2D drawImage() 和 clip() : how to apply antialiasing?

JavaGraphics2D的drawImage和clip方法绘制的BufferedImage边缘有锯齿,如何应用抗锯齿?代码:BufferedImageimg=ImageIO.read(newFile("D:\\Pictures\\U\\U\\3306231465660486.jpg"));JFrameframe=newJFrame();frame.add(newJPanel(){@OverrideprotectedvoidpaintComponent(Graphicsg){Graphics2Dg2d=(Graphics2D)g;g2d.setRenderingHint(Render