Invalid Swift Support - Files don’t match

IosXcodeSwift

Ios Problem Overview


I just re-wrote an app in Swift 2. I'm trying to upload the app to iTunesConnect (via Xcode 7 GM) for internal testing.

I wrestled with an "Invalid Swift Support" error for awhile (which has other, related questions) ... but now it's changed to something a little different.

The error from Apple now says:

Invalid Swift Support

The files libswiftCoreLocation.dylib, libswiftCoreMedia.dylib, libswiftCoreData.dylib, libswiftAVFoundation.dylib don’t match

/Payload/App.app/Frameworks/libswiftCoreLocation.dylib, /Payload/App.app/Frameworks/libswiftCoreMedia.dylib, /Payload/App.app/Frameworks/libswiftCoreData.dylib, /Payload/App.app/Frameworks/libswiftAVFoundation.dylib

Make sure the files are correct (?), rebuild your app, and resubmit it.

Don’t apply post-processing to

/Payload/App.app/Frameworks/libswiftCoreLocation.dylib, /Payload/App.app/Frameworks/libswiftCoreMedia.dylib, /Payload/App.app/Frameworks/libswiftCoreData.dylib, /Payload/App.app/Frameworks/libswiftAVFoundation.dylib.

I've been unable to find similar errors by searching for "Don’t apply post-processing", "Make sure the files are correct, rebuild your app, and resubmit it", etc.

Does anyone know how I can "Make sure the files are correct" --or-- have any other recommendations? Thank you.

Ios Solutions


Solution 1 - Ios

Same problem here. I think this is most likely a bug of the Developer Tools, related to the Bitcode.

I just found the workaround for this.

  1. Archive your app with new build number :(
  2. Find the archive (.xcarchive file) in Finder from Organizer “Show in Finder”
  3. Open the package and find directories like Products/Applications/YourApp.ipa/Frameworks/ and SwiftSupport/iphoneos/
  4. Copy all libswiftXxx.dylib files from SwiftSupport/iphoneos/ into Products/Applications/YourApp.ipa/Frameworks/ and overwrite
  5. Now, Upload to App Store from Organizer

With this process, I succeed in uploading my build. Now I’m waiting for review.

NOTE:

I’m using CocoaPods, and the ENABLE_BITCODE option was NO.

Solution 2 - Ios

Edit: CocoaPods 0.39.0 has been released which fixes this issue!

As @orkenstein mentioned, there is a simpler solution by commenting out some code in Pod-frameworks.sh. I'm including a bit more details here.

In your Xcode project directory, open Pods/Target Support Files/Pods/Pods-frameworks.sh

Comment out the following lines:

# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u  && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
  echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
  rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
  code_sign_if_enabled "${destination}/${lib}"
done

=>

# Embed linked Swift runtime libraries
# local basename
# basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
# local swift_runtime_libs
# swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u  && exit ${PIPESTATUS[0]})
# for lib in $swift_runtime_libs; do
#   echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
#   rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
#   code_sign_if_enabled "${destination}/${lib}"
# done

Save Pods-frameworks.sh and you should be good to go!

Solution 3 - Ios

The fix for this issue has been merged and it is available on the latest CocoaPods version 0.39.0.beta.5

https://github.com/CocoaPods/CocoaPods/pull/4268

To get the latest version of CocoaPods run gem install cocoapods --pre

Alternatively, follow instructions for running unreleased features: http://guides.cocoapods.org/using/unreleased-features

Once you have the latest version of CocoaPods, run pod install again.

Solution 4 - Ios

I was using fastlane gym 1.9.0 to build my app and it kept getting rejected by apple because the files didn't match, whereas if i uploaded through XCode 8 it was accepted. I checked the swift libs in the ipa's swift support folder and in the Frameworks folder, I found that the libs in the swift support folder were for swift 2.3 while in the Frameworks folder it was swift 3. So in my gym file I added the toolchain option:

gym(
  scheme: "CoCadre", 
  configuration: "Production Release",
  clean: true,
  use_legacy_build_api: false,
  toolchain: "com.apple.dt.toolchain.Swift_2_3"
)

*Note that i had to change use_legacy_build_api to false to use the toolchain option > In order to use toolchain option, need to set use_legacy_build_api: false https://github.com/fastlane/fastlane/issues/6003#issuecomment-244792185

Solution 5 - Ios

There is a little less complex solution, found on GitHub:

> I had a look around in Pods-frameworks.sh and found a section > commented as: > > Embed linked Swift runtime libraries
Commenting the block of code which copies these libraries across (and code signs them) seems to > have fixed my submission woes. I've not dived in deeper yet to see if > it's just the copying of them which causes the issues or if it's the > code-signing. I'm getting a bit out of my depth there.

Solution 6 - Ios

  1. Update your cocoapods to the latest version, type sudo gem install cocoapods in terminal.
  2. Run pod update under your project's directory.
  3. Remember to set Enable Bitcode to NO for Debug option for all your pods.
  4. Fixed

The problem is fixed because the following code in Pods-frameworks.sh:

# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u  && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
  echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
  rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
  code_sign_if_enabled "${destination}/${lib}"
done

was changed to:

# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
    local swift_runtime_libs
    swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u  && exit ${PIPESTATUS[0]})
  for lib in $swift_runtime_libs; do
    echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
    rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
    code_sign_if_enabled "${destination}/${lib}"
  done
fi

Solution 7 - Ios

My Solution for this:

I'm using Reveal through Cocoapods and Reveal needs to disable Bitcode. So I included Reveal(should work for any other Framwork) only for Debug:

pod 'Reveal-iOS-SDK', :configurations => ['Debug']

As my Reveal is now only configured for Debug, I disabled Bitcode only for Debug.

enter image description here

With this settings everything works fine, without any hacks...

Solution 8 - Ios

I've seen this error occur when integrating libraries that do not support bitcode (such as the current stable version of New Relic). The solution is either to remove the libraries, disable bitcode (and potentially not be able to submit to the store), or wait for updated binaries that support bitcode from your library vender.

Solution 9 - Ios

The error for me was that i built with Adhoc profile instead of App Store profile for uploading the spa to the app store.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDanView Question on Stackoverflow
Solution 1 - IoscockscombView Answer on Stackoverflow
Solution 2 - IosDJ TarazonaView Answer on Stackoverflow
Solution 3 - IosWill YView Answer on Stackoverflow
Solution 4 - IosZhong HuiwenView Answer on Stackoverflow
Solution 5 - IosorkensteinView Answer on Stackoverflow
Solution 6 - IosBartłomiej SemańczykView Answer on Stackoverflow
Solution 7 - IosUrkmanView Answer on Stackoverflow
Solution 8 - IosJALView Answer on Stackoverflow
Solution 9 - IosjaroraView Answer on Stackoverflow