CloudKit keyvalue pair debug ?

Hello ! I am using this iCloud key value pair mechanism to save small app configuration between iOS and tvOS. I would say it is working. But when I go back and forth between debug and release (TestFlight) modes, it is like both apps are not connected anymore. I spend a lot of time restarting all devices, rebuilding, activating / deactivating iCloud capabilities in the Xcode project. It is like the app is mixing debug and release data.

Is there an easy way to check what is happening exactly ? I know there's nothing on CloudKit console, so ....

Thank you

Frederic

Answered by DTS Engineer in 829123022

You can probably start with capturing and analyzing a sysdiagnose, as described here.

If your app isn't in production yet, you might consider clear all the keys you ever used (by setting the values to nil), and see if that changes anything. NSUbiquitousKeyValueStore allows you to store a maximum of 1024 keys, and per-key value size is limited to 1 MB. Clearing the keys may help if your data is over the quota.

You can also consider switching to a new store ID by setting a new value for the com.apple.developer.ubiquity-kvstore-identifier entitlement, which you can find in the .entitlements file in your project. This should allow you to continue your development.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

You can probably start with capturing and analyzing a sysdiagnose, as described here.

If your app isn't in production yet, you might consider clear all the keys you ever used (by setting the values to nil), and see if that changes anything. NSUbiquitousKeyValueStore allows you to store a maximum of 1024 keys, and per-key value size is limited to 1 MB. Clearing the keys may help if your data is over the quota.

You can also consider switching to a new store ID by setting a new value for the com.apple.developer.ubiquity-kvstore-identifier entitlement, which you can find in the .entitlements file in your project. This should allow you to continue your development.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

I managed to capture the sysdiagnose file ("Trigger a sysdiagnose on the device by simultaneously pressing and releasing both side volume buttons and side button" not easy to do btw .. ) I don't know what to look for, this log is really long.

Yes I am just storing 1 value with an iP address. I did a new test, now I can from the appleTV update this value and got it on my iPhone, but not the opposite way . Do you know what can cause this ? The source code is the same. I will try from another iPhone maybe ...

A typical methodology of analyzing the system log is to use the timestamp when the issue happens (or is supposed to happen), and see if there is any interesting error message around there. NSUbiquitousKeyValueStore is based on CloudKit, and so any error related to CloudKit should be relevant.

When CloudKit synchronization works on some devices, but not on others, I normally start with resetting the CloudKit state cache on the device, as described in Configure iCloud on your devices.

I'd also curious if the Synchronizing App Preferences with iCloud sample presents the same issue – If it does, you will be more confident that the issue is not on your code.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

CloudKit keyvalue pair debug ?
 
 
Q