Hi
I have built an app which is using CloudKit. I am using Xcode 8.0 and Swift. The problem is very simple. I can't fetch any data from CloudKit database when my iPhone is connected to my home WiFi. Mobile internet works perfectly fine and other WiFis from other institutions and building are also working. Apple also rejected my app because of exactly that behaviour. They told me that the app couldn't load data when they have connected the device to a WiFi which is connected to an ipv6 network.
In the simulator on my MacBook (which is connected to the same WiFi that causes the problems) it works fine too. But when I run it through my iPhone then I always get this error:
<CKError 0x17004c120: "Internal Error" (1/4000); "Couldn't get a signing certificate">
The method that causes this error is this:
func fetchNotes() {
let container = CKContainer.default()
let publicDatabase = container.publicCloudDatabase
let date = Date(timeInterval: -60.0 * 60 * 24 * 7, since: Date())
let predicate = NSPredicate(format: "creationDate > %@", date as CVarArg)
let query = CKQuery(recordType: "Images", predicate: predicate)
query.sortDescriptors = [NSSortDescriptor(key: "modificationDate", ascending: false)]
publicDatabase.perform(query, inZoneWith: nil) { (results, error) -> Void in
if error != nil {
print(error) // it lands here and the error gets printed.
}
else {
// work with the results...
}
}
}
Is this because of the ipv6 WiFi? How can I fix this problem or is CloudKit not compatible with ipv6?
I would be very happy if someone could help me 🙂
Update:
I just tried a completely new project with a new CloudKit container and just put the method above to test if I am able to fetch data from CloudKit and I get exactly the same error on my device when connected to my WiFi (my WiFi works by the way 😉 ). And in the simulator it works nice. What could be causing this problem?
The project is deployed for iOS 9.3 and I created it using Xcode 8.0.