Search code examples
iosswifticloudcloudkit

CloudKit Issue: did not find required record type


My Situation:

  • In my CloudKit Dashboard, I set a record in the PRIVATE DATA's Default Zone for testing the function of Downloading data from iCloud.
  • The thing is, there is no error occurred in my iPhone Simulator or the App translated to my phone through Xcode.
  • But when I posted my App to the TestFlight, the App downloaded from TestFlight occurred the error, did not find required recored type.

enter image description here

The thing worth be mentioned that the CardModel is a Recode Types in the CloudKit Dashboard.

My Code:

   let delegate = UIApplication.sharedApplication().delegate as! AppDelegate
   let predicate = NSPredicate(value: true)
   let query = CKQuery(recordType: "CardModel", predicate: predicate)
   self.privateDB.performQuery(query, inZoneWithID: nil) {
        results, error in
        if error != nil {
            dispatch_async(dispatch_get_main_queue()) {
                self.delegate?.errorUpdating(error)
                println("error loading: \(error)")
            }


After checking my code, I find the error is submitted by self.privateDB.performQuery(query, inZoneWithID: nil). And the errorUpdating() is the function in it's Class's Protocol Part.


My Question:

  • Why I got different results between the App translated by Xcode and the App downloaded from TestFlight?
  • I know I get to show more code, but I have no idea which part of system occurred the error. CloudKit or the certification of iCloud?


A big appreciation for your guide and answer.

Ethan Joe


Solution

  • Did you deploy your data from Development to Production region in CloudKit Dashboard? I suppose TestFlight needs the production database, not development.