Instance Method インスタンスメソッド

synchronize()

Explicitly synchronizes in-memory keys and values with those stored on disk. インメモリのキーと値をディスク上に格納されるそれらと明示的に同期します。

Declaration 宣言

func synchronize() -> Bool

Return Value 戻り値

true if the in-memory and on-disk keys and values were synchronized, or false if an error occurred. For example, this method returns false if an app was not built with the proper entitlement requests. true、もしインメモリとオンディスクのキーと値が同期されたならば、またはfalse、もしエラーが発生したならば。例えば、このメソッドはfalseを、もしアプリが適切な資格付与要請とともにビルドされなかったならば返します。

Discussion 議論

The only recommended time to call this method is upon app launch, or upon returning to the foreground, to ensure that the in-memory key-value store representation is up-to-date. このメソッドを呼び出す唯一推奨される時は、アプリ起動のとき、または前面に戻るときです、インメモリのキー値保管表現が最新情報を含むことを確実にするために。

Changes you make to the key-value store are saved to memory. The system then synchronizes the in-memory keys and values with the local on-disk cache, automatically and at appropriate times. For example, it synchronizes the keys when your app is put into the background, when changes are received from iCloud, and when your app makes changes to a key but does not call the synchronize() method for several seconds. あなたがキー値保管に対してする変更は、メモリに保存されます。システムはそれからインメモリのキーと値をローカルのオンディスクキャッシュと同期します、自動的にそして適時に。例えば、それがキーを同期するのは、あなたのアプリがバックグラウンドに置かれる時、さまざまな変更がiCloudから受け取られる時、そしてあなたのアプリがあるキーに対して変更するしかしsynchronize()メソッドを数秒間呼ばない時です。

This method does not force new keys and values to be written to iCloud. Rather, it lets iCloud know that new keys and values are available to be uploaded. Do not rely on your keys and values being available on other devices immediately. The system controls when those keys and values are uploaded. The frequency of upload requests for key-value storage is limited to several per minute. このメソッドは、新しいキーと値がiCloudへと書き出されることを強制しません。というより、それはiCloudに新しいキーと値がアップロードされることが可能であるのを知らせます。あなたのキーと値が他のデバイス上ですぐに利用可能になることを当てにしないでください。システムは、いつそれらのキーと値がアップロードされるかを制御します。キー値保管に対するアップロード要請の頻度は、分ごとに数回に制限されます。

During synchronization between memory and disk, this method updates your in-memory set of keys and values with changes previously received from iCloud. メモリとディスクの間の同期の間に、このメソッドはあなたのインメモリのキーと値の集合を、iCloudから以前に受け取られた変更で更新します。