Hoping you can help. I'm adding Today support to my app, which uses MagicalRecord https://github.com/magicalpanda/MagicalRecord to managing all my CoreData stuff.
I'm tearing my hair out trying to understand how to surface my data into the Today extension.
I have enabled app groups as outlined here http://blog.sam-oakley.co.uk/post/92323630293/sharing-core-data-between-app-and-extension-in-ios-8 however all the documentation and StackOverflow posts I'm reading relate to using CoreData directly. MagicalRecord does a lot of the hard work for you, which is why I used it as I was totally new to it all at the beginning of this project. So things like:
Where you initialise your Core Data stack, you’ll be adding a store to your persistentStoreCoordinator a little something like this:
[persistentStoreCoordinator
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil
URL:storeURL options:options error:&error]
It’s simply a matter of changing your previous value for storeURL (usually somewhere in NSDocumentDirectory) to a location contained in your shared App Group folder. You do this using
containerURLForSecurityApplicationGroupIdentifier: NSURL *directory =
[[NSFileManager defaultManager]
containerURLForSecurityApplicationGroupIdentifier:@"group.YourGroupName"];
NSURL *storeURL = [directory
URLByAppendingPathComponent:@"YourAppName.sqlite"];
... I'm not understanding how / where to implement.
I'd imagined I'd just have to set up the MagicalRecord stack in my extension as I do in my appDelegate, but of course it's failing.
Really hoping someone might be in a similar situation and be able to shed some light on how to move forward with this one.
Any code you need to me to post up just let me know.
Thanks in advance