Frage

Is there a way to add an observer for the notification the logs displays when Core Data changes the local storage?

[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](754): CoreData: Ubiquity: mobile~E358C294-F23E-4FBA-8DA6-869A3A848906:R63H5582LG~com~Test~Tester Using local storage: 0

I am asking because I want to know to which local storage Core Data has changed. Thanks a lot!

War es hilfreich?

Lösung

Unfortunately the transition from Using local storage: 1 to Using local storage: 0 is not as simple as it looks because it depends on whether Core Data had to create a brand new store and import the initial store from iCloud or whether it is opening an already existing iCloud store. I have posted a more detailed explanation and logs showing the different behaviours.

So the best way is to check if the iCloud file exists, if not you know to expect two storesDidChange notifications, the second of which means you are now using a store which has the initial iCloud store imported (note this may not be all the iCloud data).

http://ossh.com.au/design-and-technology/software-development/sample-library-style-ios-core-data-app-with-icloud-integration/sample-apps-explanations/handling-icloud-account-transitions/

There are sample apps that have implemented this here

http://ossh.com.au/design-and-technology/software-development/sample-library-style-ios-core-data-app-with-icloud-integration/

Hope these help

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top