Skip to content

Instantly share code, notes, and snippets.

@rsattar
Last active June 27, 2017 08:57
Show Gist options
  • Save rsattar/1c518ada051142359fd0 to your computer and use it in GitHub Desktop.
Save rsattar/1c518ada051142359fd0 to your computer and use it in GitHub Desktop.
Set ApplicationGroupContainerIdentifier in Settings.bundle to group.$(CFBundleIdentifier)
# Get the already-processed Info.plist, which has our bundleId, etc.
processedInfoPlistFile=$TARGET_BUILD_DIR/$INFOPLIST_PATH
# Copy the bundle identifier from our processed Info.plist
bundleId=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$processedInfoPlistFile")
# Prefix it with "group." to make the application group container id
appGroupContainerId=group.$bundleId
# Get the already-copied Settings.bundle/Root.plist
appPackageFolder=$TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH
copiedSettingsBundlePlistFile=$appPackageFolder/Settings.bundle/Root.plist
echo "Setting $copiedSettingsBundlePlistFile's ApplicationGroupContainerIdentifier to $appGroupContainerId"
# Save the app group container id as the value for Settings.bundle
/usr/libexec/PlistBuddy -c "Set :ApplicationGroupContainerIdentifier $appGroupContainerId" "$copiedSettingsBundlePlistFile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment