简体   繁体   English

iOS Today Extension - 在之间共享核心数据

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

相关问题 在Swift中的应用和今日扩展之间共享核心数据数据库 - Share Core Data database between app and today extension in Swift 带有核心数据的 iOS 今日扩展 - iOS today extension with core data 除了“ UserDefaults”之外,还有什么其他方法可以在iOS中的“今日小工具扩展”和主“容器应用程序”之间共享数据 - Is there any other way than `UserDefaults` to share data between `Today Widget Extension` and the main `Container Application` in iOS 如何在 iOS 应用程序和今日视图扩展程序之间共享数据 - How do I share data between iOS app and today view extension (iOS Swift)在应用程序和Today Extension之间共享EKEventStore和访问 - (iOS Swift) Share EKEventStore and access between app and Today Extension 无法在应用程序和今日扩展之间共享数据 - Can't share data between app and today extension iOS共享扩展 - 如何访问核心数据 - iOS Share Extension - How to access core data 如何通过Today Extension(iOS8)访问Core Data / CouldKit - How to access Core Data/CouldKit via Today Extension (iOS8) iOS - 通知今天扩展主应用程序中的核心数据更改 - iOS - Notify today extension for Core Data changes in the main app Today扩展内的iOS Access核心数据自动生成的类 - iOS Access Core Data Auto Generated Classes inside Today Extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM