I have what I perceive to be a relatively complicated data model, with multiple many-to-many relationships that are necessary in order to get the functionality that I want. Without iCloud everything works great: CPU low, memory usage usually around 15 mb/s, maximum of 30.
I've implemented bare bones iCloud Core Data syncing following Tim Roadley's wonderfully helpful tutorial found here http://timroadley.com/2012/04/03/core-data-in-icloud/
First question: when first opening the app, there's sometimes a lag in which data stored cannot be accessed. I do a
NSFetchRequest
and get back an empty array. After a few seconds I can retrieve data.Why is this happening? I thought with iCloud enabled in Xcode 5, two data stores were being made, one for local use and one for iCloud use? should not the local store be accessible?
I've gotten around the first bit by having a 'portal' view controller, so that the lag can (in most cases) be overcome (sometimes you see a blank TVC.. not happy)
Second question, and the more pressing one: after a few seconds (usually around 15) something happens in a background thread, CPU usage shoots to 99% and memory goes way up from 10 - about 100 mb/s. It remains that high - it doesn't go up (nor does it crash), and it doesn't go down for the remainder of usage (I mean at least the 2 hours I've had it constantly running). No crashing! just kinda laggy interface interaction.
Why is this happening and how can I solve it?
I don't have a great understanding of how iCloud syncing works; somehow transaction logs are made, stored as plists, and sent out somewhere and something happens. What I'm assuming is that the transaction logs I have are really big- perhaps due to the several many-to-many relationships I have? This question suggests as such (there is no solution to his problem, and I also don't have the ever-increasing memory usage: mine stops at a certain point): Core Data with iCloud causing low memory warnings and crashes, memory usage constantly grows
thoughts: - If it were the transaction logs, shouldn't they be deleted at some point? say after the log has been uploaded to icloud? why does it just sit there taking up space? - Is there any way to define the times in which syncing is done? or manually delete the transaction log? Has anyone experienced this/ solved it?