Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have the correct code signature.

I have a project that uses Swift and Objective, no Cocoapods.

Shortly after uploading my IPA through Application Loader I received this email from Apple:


Dear developer,

We have discovered one or more issues with your recent delivery for "EdgevisTest". To process your delivery, the following issues must be corrected:

Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have the correct code signature. Make sure you’re using the correct signature, rebuild your app using the current public (GM) version of Xcode, and resubmit it. Don’t just modify the code signature of libswiftAVFoundation.dylib.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team


I should point out that I have used a script to resign the IPA for a customer. Any ideas what I can do to sort this?


Attached below is the script I have used.


# !/bin/bash
SOURCEIPA="$1"
DEVELOPER="$2"
MOBILEPROV="$3"
TARGET="$4"
BUNDLE="$5"

unzip -qo "$SOURCEIPA" -d extracted
APPLICATION=$(ls extracted/Payload/)

#Remove the current code signature data.
rm -rf "extracted/Payload/$APPLICATION.app/_CodeSignature"

#Replace embedded provisioning profile with new one
cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"
echo "Resigning with certificate: $DEVELOPER"

find -d extracted  \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt
if [[ "$BUNDLE" != 'null.null' ]]; then
   echo "Changing BundleID with : $BUNDLE"
   /usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE" "extracted/Payload/$APPLICATION/Info.plist"
fi
security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist
var=$((0))
while IFS='' read -r line || [[ -n "$line" ]]; do
  if [[ "$BUNDLE" != 'null.null' ]] && [[ "$line" == *".appex"* ]]; then
    echo "Changing .appex BundleID with : $BUNDLE.extra$var"
    /usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE.extra$var" "$line/Info.plist"
    var=$((var+1))
  fi  
  /usr/bin/codesign --continue -fv -s "$DEVELOPER" --entitlements "t_entitlements.plist"  "$line"
done < directories.txt

echo "Creating the Signed IPA"
cd extracted
zip -qry ../extracted.ipa *
cd ..
mv extracted.ipa "$TARGET"
rm -rf "extracted"
rm directories.txt
rm t_entitlements.plist
rm t_entitlements_full.plist

Hi Rhuari123,


Were you able to solve this issue. I am facing the same problem with but no solution in sight. If you can kindly help.

Ive even signed the framework with the main app target entitlements but nothing works.

Anyone solution for this issue?
Hi! What worked for me (2020) was checking
XCode > Preferences > Locations
and making sure that the "Command Line Tools" was correct (matches the xcode version)

Started seeing this same issue with "libswiftAVFoundation.dylib" this week:
  • Created archive in Xcode, no custom post build scripts.

  • Uploaded two builds using Xcode 12.4 (12D4e) via Organizer.

  • Both builds were invalidated on TestFlight once submitted for public beta review.

  • Tried cleaning build folder.

  • Haven't made any changes to any build settings recently.

I don't have "AVFoundation" framework or "libswiftAVFoundation.tbd" embedded (in Project > General), going to try doing that and see what happens, but it's always worked without in the past.

Build Settings:
  • Swift Language Version: Swift 5

  • Always Embed Swift Standard Libraries: YES

Also just ran into this -- also on Xcode 12.4 (12D4e).

TestFlight internal testing worked fine. Received an email similar to the OP immediately after submitting for review.
Getting same issue with Xcode 12.4 (12D4e). Whenever tries to submit for external testers, it rejects the binary.

Facing the same issue with Xcode 12.4 (12D4e). Trying to submit for external review but status is being changed to "Invalid Binary".
Same issue.
I tried to delete DerivedData, rebuild the project and submit it for review. Wish me good luck.
Repackaged and uploaded, solved this issue.
I had the same issue, could it be a problem in the appstore or xcode instead of us?

same issue, bit arbitrary, sometimes the binary is valid sometimes it comes back with the error
Happend just now for me. Haven't seen this before.
Same issue on Xcode 12.4 (12D4e). Occurs a couple minutes after releasing the app version to external testers. My application is using Cocoapods. Was able to resolve the "Invalid Swift Support" error by re-installing my pods (ie. pod deintegrate -> pod install). Still seems very random, hopefully this may work for someone else too.
We haven't changed our build methods for a few months, and we are randomly getting this error now as well. Xcode 12.4.
Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have the correct code signature.
 
 
Q