简体   繁体   English

iOS - 与多个应用程序目标共享今日扩展?

[英]iOS - Share a Today Extension with multiple app targets?

I have a project with multiple app targets (about 25).我有一个包含多个应用程序目标的项目(大约 25 个)。

I'm going to make a Today Extension for those apps but I don't want to create about 25 extensions with the same code and configuration.我打算为这些应用程序制作一个 Today Extension,但我不想用相同的代码和配置创建大约 25 个扩展。

Is it possible to create only one Today Extension that I assign to the 25 apps ?是否可以只创建一个分配给 25 个应用程序的 Today Extension?

It is possible, but with some manipulations.这是可能的,但需要一些操作。 To connect extension with a target you need:要将扩展与目标连接,您需要:

  1. Add your extension to target's embedded binaries ("General" tab of project's settings)将您的扩展添加到目标的嵌入式二进制文件(项目设置的“常规”选项卡)

在此处输入图片说明

  1. Add extension's target to target dependencies ("Build Phases" tab of project's settings)将扩展的目标添加到目标依赖项(项目设置的“构建阶段”选项卡)

在此处输入图片说明

  1. Prefix your extension's bundle identifier with the parent app's (your current target) bundle identifier or you will get an error:使用父应用程序(您当前的目标)包标识符作为扩展程序包标识符的前缀,否则您将收到错误消息:

在此处输入图片说明

So when you will build or distribute your target make this manipulations and fix provisioning profile's issues with Xcode (it can do this automatically).因此,当您构建或分发目标时,请进行此操作并使用 Xcode 修复配置文件的问题(它可以自动执行此操作)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM