Timeout during initialization of CloudKit schema

Hi everybody,

I am having trouble further initializing my CloudKit schema with an NSPersistentCloudKitContainer and store descriptions for booth public and private database scopes. The execution environment is macOS 12.3.1.

container.newBackgroundContext().perform {
  do {
    print("Starting to initialize CloudKit Schema...")
    try container.initializeCloudKitSchema(options: [])
    print("CloudKit Schema succesfully initialized.")
  } catch {
    print(error)
  }
}

After about 30 seconds, the above code block goes into the catch statement with the following error:

"Error Domain=NSCocoaErrorDomain Code=134060 \"A Core Data error occurred.\" UserInfo={NSLocalizedFailureReason=Failed to initialize CloudKit schema because the requests timed out (a 30s wait failed).}"

During that 30 seconds of my app trying to init the schema, I noticed that the CloudKit Console was also having trouble communicating correctly with the container:

When I reload the CloudKit Console after the init got into the 30s timeout. The Console has no more trouble retrieving the container details. Weird.

My mac has a proper network connection and is able to insert, update & delete data from the CloudKit store.

I have no clue where that 30s timeout originates from.

Any help would be really appreciated.

Replies

I'm seeing this issue as well. Did you ever figure it out?

Unfortunately not, I quit iOS development a month later. I just ignored the problem. I seem to recall that in some cases the CloudKit model changes came through anyway.