Search code examples
ios8cloudkitxcode6.1

Cloudkit error when querying public database from simulator


I'm working on an app where I recently decided to go with CloudKit and am now at the point where I need to implement the backend functionality. In a nutshell, this app will use a collectionview to display images retrieved from a CK database. Up until now, I just dumped some images in a folder on my desktop and retrieved/parsed the images from there to render the collectionview. I then used the CK dashboard to create some records and wrote an initialization method to try and retrieve them. I was getting various CKErrors, such as network failure, error completion without receiving a response from the server, could not send a valid signature, etc. I immediately assumed the issue was with my code since it was my first attempt with CloudKit. However, I ran the latest code on my device before posting on SO and it worked! I got a successful response with the number of records in the results array that I was expecting.

So now I know longer need help with fetching CKRecords like I initially thought. But how do I resolve this issue with the simulator? I saw some other post about making sure you're signed into iCloud on the simulator. I believe I am, but do not know how to check to be sure. Also, I'm running Yosemite and Xcode 6.1.

Any help is appreciated!


Solution

  • To use your Apple ID on iCloud on the iPhone Simulator, make sure you turn off Two-way authentication. It should then work on the simulator.