Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Data with MagicalRecord does not save to iCloud

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.

Before:

[MagicalRecordHelpers setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"hdhomerun.sqlite"];

After:

[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.

The version of MagicalRecord is this one:
https://github.com/magicalpanda/MagicalRecord

like image 467
Kobski Avatar asked Jan 05 '12 16:01

Kobski


People also ask

How do I save in Core Data?

Right-click on your project's folder in the project navigator and then New File… In the new window, type “data” in the top right corner, select Data Model, and press Next. Give it a name, and save it. Now, let's add all the necessary code to connect Core Data with our project.

How do I use Core Data?

Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.


1 Answers

OK, I'll answer my own question.

MagicalRecord, at the point when I was using it, did not work with iCloud.

But it has recently been fixed by this commit: https://github.com/emrosenf/MagicalRecord/commit/8415276615d9a9e12db9c0207bae373b7397dd56

And now it is working fine.

like image 109
Kobski Avatar answered Oct 05 '22 16:10

Kobski