I am using MagicalRecord in my project. It has been working fine so far with a SQLite store. But now I am trying to "upgrade" to iCloud to have sync between my iPhone and iPad versions.
But it is not working as I expected. The app still works the same - data is getting saved and read back, but it is not saved in iCloud as I would expect.
The only change I have made is in the MagicalRecord setup.
[MagicalRecordHelpers setupCoreDataStackWithiCloudContainer:@"AAAAAAAAAA.com.unpaq.hdhomerun" localStoreNamed:@"hdhomerun_local"];
The AAAAA's are not AAAAA's in the code, but my private ID from developer profile.
I can see in the output log that iCloud is detected and no errors occur. I also tried stepping through the code and it all looks fine.
What am I missing? Do I need to listen to some event? I have not been able to find an example of how to use MagicalRecord with iCloud.
OK. I will take a look at https://github.com/brunogb/MagicalRecord, to see if that works any better.
I'll get back to you with my findings.
Hey is there any word on iCould support in MagicalRecord? When I was looking at this a few months back, it seems that iCloud (not MR) was a bit buggy with it's syncing support. Have you found that the bugs have been worked out?
Actually, this commit:
... actually made it work. But I must admit that after a while, it stopped working. I think you are right that the error could be iCloud and not MR. I have not had time to debug it yet.
No, I am not sure either. But before this code change, nothing was stored in iCloud.
This issue caused me a lot of grief. After a close inspection of the Apple iCloud docs, it seems that the NSPersistentStoreUbiquitousContentNameKey is actually required, whereas the NSPersistentStoreUbiquitousContentURLKey can be autogenerated.
@emrosenf Indeed. After watching a rather lengthly thread in the Apple Forums, I decided to shelve my app until CoreData sync got a little more stable. Are you saying that your app is working without fail? In your testing, were you able to nuke the storage and start over?
@bunchjesse It is all "working", but based on the number of support queries I've received about people who think it isn't working (and maybe it's not for them?) you could make a very good case to leave it out for now. It's anything but consistent and impossible to debug.
Have someone enabled that iCloud feature? I am always gettings "iCloud is not enabled" in log, however it's already enabled on device. What's the problem?
I had the same issue and went back to bare bones Coredata to have a bit more control over things, but even with that the sync is flaky, more often than not on the first run it wont sync but somehow cleans itself up 'in time'..... I really wish there was an alternative to iCloud for sync sometimes
Honestly, I'm not sure anyone on the team uses iCloud anymore. It's just too unreliable in normal operation, and does not provide anywhere near enough information to effectively diagnose issues. I'm keen to pull our existing iCloud code to bits and see what does/doesn't work, but there just aren't enough hours in the day right now.
The only solution that I've heard works reliably is @drewmccormack's https://github.com/drewmccormack/TICoreDataSync but the setup overhead for that project is not insignificant in my experience.
Whilst I agree that core data iCloud sync is shocking, it's transparent to the user, personally I would prefer dropbox but iOS is hardly an open platform and asking the user for their Dropbox login is more work for them and less likely to happen. Third party solutions may work but the user has to sign up.
Have people filed bug reports to apple? The more people that do, the more likely it'll get fixed
Does ticoredatasync play well with magical record? I saw a tweet of tonyarnold that suggested it didn't, though it was from July last year. Is this still the case?
@casademora but how do you do that? I'm setting up MagicalRecord with setupCoreDataStackWithAutoMigratingSqliteStoreNamed- but how do I do this with TICoreDataSync instead?
Can you deliver a simple example code to get started?
[MagicalRecord isICloudEnabled] always returns false.
How i can i turn this true. Any idea?
Given the age of this issue, and the volume of issues we have to work through, I've decided to close this alongside a number of other older issues.
If you can still replicate the issue under the latest in-development version of MagicalRecord (3.0 at the time of writing), please feel free to re-open and one of @magicalpanda/team-magicalrecord will take another look. Thanks!
I haven't read the entire thread but found it because I was experiencing similar symptoms.
After changing this:
MagicalRecord.setupCoreDataStackWithiCloudContainer("some-id", localStoreNamed: "AppName")
MagicalRecord.setupCoreDataStackWithiCloudContainer("some-id", contentNameKey: "AppNameData", localStoreNamed: "AppName", cloudStorePathComponent: nil)
I got iCloud syncing working between my devices. Hope this helps.