Reputation: 1873
I'm implementing iCloud support in my core data based app. It works well enough but I've noticed a strange behavior on a device where you run the app for the first time.
I run the app on Device A and add some entries. The I install the app in device B, from the debug I see:
2013-12-02 18:25:39.626 My App[256:3707] -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](754): CoreData: Ubiquity: mobile~XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:myawesomeapp
Using local storage: 1
and after a minutes or so:
2013-12-02 18:26:26.234 My App[256:1803] -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](754): CoreData: Ubiquity: mobibile~XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:myawesomeapp
Using local storage: 0
and all my entries appear in device B
During this time the app is unresponsive. No crash but I can touch everywhere but no response from app. After storage switch and all datas appear the app works flawlessly.
Now the question is: There is a way to say to user "Wait, I'm checking iCloud and retrieving data"
And, I've noticed that the above debug messages are showed only if I run the app on a iOS7 device. If I run it on iOS 6.x I have no clue about what's happening.
Thanks, Max
Upvotes: 0
Views: 1418
Reputation: 80273
Check out the WWDC 2013 Video Session about Core Data (developer account required). This is explained very well there, starting around minute 7.
It stats explicitly, that the first time fetch of iCloud data is synchronous, so you have to make sure to call that in separate non-UI thread. In iOS 7, this should be asynchronous automatically.
Maybe the best option if to refactor for iOS 7 to take advantage of the new - much simpler - APIs. You could set a switch in your code and use the two methods according to which OS the device is running.
The message Using local storage: 0/1
is explained around minute 6.
Upvotes: 2