16

I have a project with multiple app targets (about 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.

Is it possible to create only one Today Extension that I assign to the 25 apps ?

mfaani
  • 33,269
  • 19
  • 164
  • 293
David Ansermot
  • 6,052
  • 8
  • 47
  • 82
  • did you find the answer? i'm stuck with this and even tried UserDefinedConstants, but still have an error about wrong prefix. – pash3r Jun 23 '15 at 11:44
  • http://stackoverflow.com/a/26310020/1387413 did u see this? but in this way you will have to create about 25 widgets, but with one source code for all widgets – pash3r Jun 23 '15 at 14:06
  • @pash3r I don't want to have 1 extension for each targets, but 1 extension for all the targets. – David Ansermot May 13 '16 at 13:30
  • @David'mArm'Ansermot Did you solve this any better than the answer below?.. It feels wrong to do it like that. I'd like an automated solution. – Sti Jan 04 '17 at 11:03
  • No, I had to make on extension by targets... – David Ansermot Jan 05 '17 at 11:18

1 Answers1

8

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)

enter image description here

  1. Add extension's target to target dependencies ("Build Phases" tab of project's settings)

enter image description here

  1. Prefix your extension's bundle identifier with the parent app's (your current target) bundle identifier or you will get an error:

enter image description here

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).

Vlad
  • 7,199
  • 2
  • 25
  • 32