Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'

Turns out the error is related to using Swift (both the app and the extension make use of Swift).

For the app, I had to set:

Embedded Content Contains Swift Code: YES

and for the extension:

Embedded Content Contains Swift Code: NO

Xcode 8 and 9

Looks like this has been renamed to Always Embed Swift Standard Libraries in Xcode 8 and 9. So, for the app:

Always Embed Swift Standard Libraries: YES

and for the extension:

Always Embed Swift Standard Libraries: NO

The only solution that worked for me was to add this Run Script to the App Extension target:

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then 
    rm -fr Frameworks
fi

enter image description here Source: https://github.com/CocoaPods/CocoaPods/issues/4203


So 3 steps to fix this from build settings

  1. Container App: Embedded Content Contains Swift Code: YES
  2. Extension: Embedded Content Contains Swift Code: NO
  3. Extension: Runpath Search Path = @executable_path/../../Frameworks