Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Today Extension - Share core data between

I have an app which uses core data and i'm trying to add a today extension to it which also access the data I have it set up so far and its able to access the data, but i'm having trouble with the classes for the entities. I get the following error

CoreData: warning: Unable to load class named 'Med_Track_2.Medicine' for entity 'Medicine'

Med_Track_2 is the product name for the main app, Medicine_Tracker_2 is the name for the extension The medicine class is added to both targets

Is there a way around this?

like image 536
Ceri Turner Avatar asked Sep 18 '14 12:09

Ceri Turner


People also ask

What is Share extension in iOS?

Share Extension is an easy way that Apple provides to share contents (images, audio, files, etc.) from one app to another, even made by different developers.

Where is Core Data stored?

The persistent store should be located in the AppData > Library > Application Support directory.

What is iOS Core Data?

Core Data is an object graph and persistence framework provided by Apple in the macOS and iOS operating systems. It was introduced in Mac OS X 10.4 Tiger and iOS with iPhone SDK 3.0. It allows data organized by the relational entity–attribute model to be serialized into XML, binary, or SQLite stores.


1 Answers

You have to share the resources between your app and your extension. Read the "Sharing Data with Your Containing App" chapter: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1

Also you have to add the files you want to use to the Extension's target too. (Edit the Build phases / Compile Sources sections of the extension's target)

like image 108
Dávid Kaszás Avatar answered Sep 28 '22 04:09

Dávid Kaszás