Swift Package binary framework issue

When adding a Swift Binary Package to an Xcode project that also have an extension the binary package will be copied both to the Plugins folder and the Frameworks folder.

This happen on Xcode 12.1 and earlier.

My project build settings does not contain anything that copies the frameworks to the Plugins folder.

Is there a known workaround to solve this?.

Many thanks.

I have crated a bug report regarding this issue containing a sample project to reproduce the bug SR-13840.

9 Likes

This is also happening to me and is preventing me from deploying to Itunes. I get a Transporter Error:

[04:36:09]: [Transporter Error Output]: ERROR ITMS-90680: "Invalid directory. The bundle Payload/BinarySPMTest.app/PlugIns/Binary.framework is not contained in a correctly named directory. It should be under "Frameworks"."
[04:36:09]: [Transporter Error Output]: ERROR ITMS-90685: "CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.test.binary' under the iOS application 'Test.app'."
[04:36:09]: [Transporter Warning Output]: WARNING ITMS-90806: "CFBundleIdentifier collision. Each bundle must have a unique bundle identifier. The bundle identifier 'com.test.binary' is used in the bundles '[Payload/BinarySPMTest.app/Frameworks/Binary.framework, Payload/BinarySPMTest.app/PlugIns/Binary.framework]'"
[04:36:10]: Transporter transfer failed.
1 Like

I was able to remove the frameworks in the PlugIns folder via a Run Script build phase (specify the path to each framework in input files - $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH)/Binary.framework):

#!/bin/bash

COUNTER=0
while [ $COUNTER -lt "${SCRIPT_INPUT_FILE_COUNT}" ]; do
    tmp="SCRIPT_INPUT_FILE_$COUNTER"
    FILE=${!tmp}

    echo "Removing $FILE"
    rm -rf "$FILE"
    let COUNTER=COUNTER+1
done
8 Likes

This worked perfectly for us. Thank you so much!

For more information about this issue, it started happening when we migrated to use Plaid's Swift Package, on Xcode 12.2. Plaid uses binary framework in their Swift Package, so we had to add a Run Script with the script above, and input files as $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH)/LinkKit.framework

This resolved both of the Transporter Errors mentioned above, ERROR ITMS-90680 and ERROR ITMS-90685.

1 Like

I’m glad it fixed it for you! Hopefully this gets resolved in the next Xcode version automatically :)

2 Likes

+1 on this.

I just had this same issue with a customer already and converged to the same solution mentioned here by @xezero.

The problem is that SPM copies the binary framework to EVERY "Copy Files" build phase in the app's build phases.

1 Like

Had the same issue with the OneSignal framework. Thanks for the explanation on the source of the problem. I wasn't able to make the script run, apparently 'cause I needed to change the Build System to the legacy one but that brought some issues with the OneSignalServiceExtension not being able to load the module.
Finally I got to fix the issue by deleting the framework after archiving. The steps were:

  1. Archive
  2. Show in finder
  3. Right click > Show package contents of the .xcarchive
  4. Products > Applications > xx.app > Right click Show package contents
  5. Plugins > Delete the .framework
  6. Go to Trash bien and permanent delete the .framework

After that just proceed to upload to Apple connect as usual, should be able to proceed.

![2|690x332]

We just had a report of this issue also affecting exporting AppClips.

The binary asset is also copied to the AppClips/ of the app which makes it invalid to Xcode Organizer

We experienced a similar issue in Xcode 12.4 where a binary framework would be copied twice in to the archive, both in . and ./frameworks. The framework is depended by both another dependency and the app itself, so that might be the reason why it got copied twice.

Upgrading to Big Sur and Xcode 12.5 toolchain solved the problem.