[英]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'
CoreData:警告:无法为实体'Medicine'加载名为'Med_Track_2.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 Med_Track_2
是主应用程序的产品名称, Medicine_Tracker_2
是扩展名称。药物类被添加到两个目标
Is there a way around this? 有没有解决的办法?
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
阅读“与您的应用程序共享数据”一章: 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. 此外,您还必须将要使用的文件添加到Extension的目标中。 (Edit the Build phases / Compile Sources sections of the extension's target)
(编辑扩展程序目标的构建阶段/编译源部分)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.