Вопрос

I currently have my CoreData-iCloud setup working. Every time the user adds/deletes/edits entires in one of his devices, the changes are synced to iCloud (if available) and then pushed to his other devices when he opens the app.

Unfortunately, iCloud is not instantaneous. When the user opens the app in his second device, it takes 10~20 seconds on a solid connection for the synced data to appear.

Is there any way to detect when the application connects with iCloud, to inform the user that there's actually something going on, and the app is working (show a little spinner somewhere)?

At least to be able to manually trigger an iCloud update via pull to refresh, or something. It would be awesome being able to show the user something that tells him "your data is on your way, hold a little longer".

Thanks.

Это было полезно?

Решение

Take a look at these sample apps, they use the status of log files in iCloud to determine when upload or download activity is underway.

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

Другие советы

There's no documented API for checking the status of transaction logs with CoreData-iCloud. There's definitely no way to "trigger" an iCloud update, but to check pending data, you might be able to hack together something using NSMetadataQuery and iCloud KVS, but it's also going to be imprecise and unpredictable. Hopefully this is added in iOS8 (you might want to file a Radar while you're at it).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top