简体   繁体   English

CKQueryOperation iOS 9仅可插入工作

[英]CKQueryOperation iOS 9 only work plugged in

I am using CloudKit in my iOS 9 app and I have a CKQueryOperation that work fine and performs as expected when plugged into the Mac. 我在iOS 9应用程序中使用CloudKit,并且具有CKQueryOperation ,可以正常工作,并且在插入Mac时可以按预期执行。 As soon as the query is run when it is not plugged in to the Mac, it does not finish. 当查询未插入Mac时运行后,它不会完成。 There is no error message, the activity indicator I added never stops and the results are never displayed. 没有错误消息,我添加的活动指示器永远不会停止,并且永远不会显示结果。

If I start the operation when unplugged, then plug it in it completes too. 如果我在拔下电源时开始操作,则将其插入也就完成了。

The code was copied and adapted from an app built in Xcode 6.4 and works as expected in that app. 该代码是从内置于Xcode 6.4的应用程序中复制和改编而成,并可以在该应用程序中正常运行。

Any ideas why this could be happening? 任何想法为什么会发生这种情况? Could it be anything to do with app thinning in iOS 9? 可能与iOS 9中的应用程序精简有关吗?

Thank you 谢谢

ANSWER 回答

Adding this fixed the issue: queryOperation.qualityOfService = NSQualityOfService.UserInitiated 添加此问题已解决: queryOperation.qualityOfService = NSQualityOfService.UserInitiated

The default QoS changed in iOS 9. If the query operation is user initiated, then it needs to be marked as such. 在iOS 9中更改了默认QoS。如果查询操作是用户启动的,则需要将其标记为此类。

See CKOperation.h and the QualityOfService property. 请参阅CKOperation.h和QualityOfService属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM