In iOS 8, when we create an app extension, we have to decide which target it is attached to. The extension will have the same bundle ID's prefix as the target.
You can access Target Membership by selecting file and opening the right menu in Xcode (the menu is called Inspectors ). Then, in File Inspector at the bottom of the menu, find Target Membership . It's very important to check all files in your project because without this you won't be able to build a new app target.
iOS Deployment Target(IPHONEOS_DEPLOYMENT_TARGET) Deployment Target is a minimum version of iOS which is supported by your target. It means that: as a developer you support this version and you are able to support all next compatibility. as a user you should have at least this version of iOS.
A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
To share one widget with others targets, you only need to add widget.appex target to Embedded Binaries
for every parent target in General
configuration tab
Then you'll get Embed App Extensions
area at Build Phases
automatically
This is my setup: I have 3 targets (production, staging, local) and an extension target that I don't want to duplicate 3 times.
Just to clarify Neo Chen's answer, edit each of your parent targets' schemes:
Build > Pre-actions > New Run Script Action > Provide build settings from (parent scheme).
Paste this for each extension:
#!/bin/bash buildID=${PRODUCT_BUNDLE_IDENTIFIER} extId="notification-service" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $buildID.$extId" "${SRCROOT}/${extId}/Info.plist"
Seems to work on first build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With