filo
filo

Reputation: 253

Xcode iOS bundle contains disallowed file 'Frameworks'

I am trying to publish an iOS swift app. I use Xcode 9.4.1. The app contains a share extension that does HTTP uploads of files. The share extension uses SwiftHTTP. Validation of the app fails with the following errors:

Invalid Bundle. The bundle at 'FooBar.app/PlugIns/FileUploadextension.appex' contains disallowed nested bundles.
An unknown error occurred.

Invalid Bundle. The bundle at 'FooBar.app/PlugIns/FileUploadextension.appex' contains disallowed file 'Frameworks'.
An unknown error occurred.

I checked other answers on StackOverfllow about the error messages.

I disabled embedding of swift libraries for the extension:

enter image description here

Embedding is enabled for the main app:

enter image description here

There is a frameworks copy step for the extension:

enter image description here

I tried adding this script to the extension build phase:

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

With this script in place the app passes validation but the extension does not work. It fails with:

Hub connection error Error Domain=NSCocoaErrorDomain
Code=4097 "connection to service named
xxx.FooBar.FileUploadextension"
UserInfo={NSDebugDescription=connection to service named

When I open my my FileUploadextension.appex in Finder I have a Frameworks directory with SwiftHTTP.framework in it. How can I fix the problem to pass the validation and have the extension working?

Upvotes: 2

Views: 3184

Answers (1)

Darren
Darren

Reputation: 10398

So my problem was with an app extension (Share extension) needing a library. Your extension cannot have the library embedded, so what you must do is embed the library in the main app then link to it from the extension.

If you are using Carthage, then I assume you have the Carthage copy script added as a Run Script.

enter image description here

You must only have this for the Main App and NOT the extension. Any libraries that the extension uses must be listed in the Input Files.

Then in your extension, simply add the framework as a linked binary

enter image description here

Remove your Copy Frameworks step from your extension too.

Upvotes: 3

Related Questions