1

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. As soon as the query is run when it is not plugged in to the Mac, it does not finish. 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.

Any ideas why this could be happening? Could it be anything to do with app thinning in iOS 9?

Thank you

ANSWER

Adding this fixed the issue: queryOperation.qualityOfService = NSQualityOfService.UserInitiated

Tom Coomer
  • 6,227
  • 12
  • 45
  • 82

1 Answers1

4

The default QoS changed in iOS 9. If the query operation is user initiated, then it needs to be marked as such.

See CKOperation.h and the QualityOfService property.

Bob
  • 56
  • 1
  • The query is run on ViewDidLoad and using a UIRefreshController when the user pulls down on the collection view. Is this what you meant? I'll take a look at the documentation. – Tom Coomer Aug 29 '15 at 20:27
  • I have added `queryOperation.qualityOfService = NSQualityOfService.UserInitiated` which has fixed this issue. – Tom Coomer Aug 29 '15 at 20:36