117

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.

3
  • I have exactly same problem. Any solutions? Sep 11, 2015 at 20:01
  • Are you resigning this app? Is this a direct upload from Xcode?
    – Andy
    Sep 12, 2015 at 3:11
  • @Andy direct upload from Xcode immediately after archiving it.
    – Dan
    Sep 12, 2015 at 5:29

9 Answers 9

82

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.

14
  • What iOS SDK are you targeting? I thought you couldn't submit to the store with bitcode disabled.
    – JAL
    Sep 12, 2015 at 14:03
  • 3
    In my case, SwiftSupport/iphoneos/ is empty. Sep 13, 2015 at 15:34
  • 2
    Validation succeeded for me but the build is still Processing after ~12 hours in the Prerelease section of iTunes Connect.
    – ldiqual
    Sep 16, 2015 at 21:25
  • 2
    hey thanks for this! I'm still getting a warning about API analysis file too large cl.ly/image/0s0N0s441s0X -- but the important thing is that it still passed and was able to get into TestFlight.
    – ded
    Sep 18, 2015 at 17:48
  • 1
    What should I do if there is no folder SwiftSupport/iphoneos/ inside my .ipa? Nov 25, 2015 at 10:04
49

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!

4
16

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.

3
  • This is the money maker Oct 4, 2015 at 1:21
  • The tears are coming. Thank you!
    – MQLN
    Nov 25, 2015 at 23:23
  • The error doesn't have to do specifically with CocoaPods; we are experiencing the same issue and don't use CocoaPods.
    – devios1
    Nov 25, 2016 at 6:00
8

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

2
  • Thank you! I am also using Fastlane and Gym and this fixed the issue. Sep 19, 2016 at 18:40
  • Thanks, that helped to fix the issue when using Gym as well. Please note that I was still able to use this solution with use_legacy_build_api: true Nov 22, 2016 at 9:45
6

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.

4
  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
2

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...

0

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.