简体   繁体   English

在应用程序和扩展程序之间共享 NSPersistentCloudKitContainer

[英]share NSPersistentCloudKitContainer between app and extension

I have an embedded framework that defines my core data container on CloudKit with:我有一个嵌入式框架,它在 CloudKit 上定义了我的核心数据容器:

let container = NSPersistentCloudKitContainer(name: containerName, managedObjectModel: objectModel)

This embedded framework is used by the app to insert/read data in this coredata container.应用程序使用此嵌入式框架在此 coredata 容器中插入/读取数据。

I want to add an (intent) app extension that may act directly on this same coredata container.我想添加一个(意图)应用程序扩展,它可以直接作用于同一个 coredata 容器。

How can I access this CloudKit container from the extension?如何从扩展访问此 CloudKit 容器? Is there a way to do that?有没有办法做到这一点? And also how to share the same object model file (.xcdatamodeld) between app and extension?以及如何在应用程序和扩展程序之间共享相同的 object model 文件(.xcdatamodeld)?

You need to use App Group , and I can provide you this example for starting point.您需要使用App Group ,我可以为您提供这个示例作为起点。

Also if you are interested in how to pass data from Siri intent to your app, take a look at this question此外,如果您对如何将数据从 Siri 意图传递到您的应用程序感兴趣,请查看此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 NSPersistentCloudKitContainer 在用户之间共享核心数据 - Share Core Data between users with NSPersistentCloudKitContainer 在iOS App和WatchKit Extension之间共享Plist - Share Plist between iOS App and WatchKit Extension 在iOS App及其扩展程序之间共享情节提要 - Share Storyboard between iOS App and its Extension 如何在App及其扩展之间共享课程? - How to share a class between app and it extension? iOS使用Alamofire快速在应用程序和共享扩展之间共享Cookie - iOS swift using alamofire to share cookie between app and share extension 用于在共享扩展和iOS应用之间共享文件路径/文件的代码 - Code to share file path/file between a share extension and iOS app 如何在React Native应用程序和共享扩展之间共享Realm数据库 - How to share a Realm Database between a React Native app and a Share Extension 在React Native应用和Swift Share Extension之间共享UserDefaults - Share UserDefaults between React Native app and Swift Share Extension 在iOS8中的App和App Extension之间共享用户对象 - Share User Object between App and App Extension in iOS8 如何在WatchKit扩展和iPhone应用程序之间共享钥匙串数据 - How to share keychain data between a WatchKit extension and an iPhone app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM