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.

Community
  • 1
  • 1
Dan
  • 4,197
  • 6
  • 34
  • 52

9 Answers9

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.

cockscomb
  • 996
  • 6
  • 3
  • What iOS SDK are you targeting? I thought you couldn't submit to the store with bitcode disabled. – JAL Sep 12 '15 at 14:03
  • I'm targeting iOS 8 and I was able to submit the app using the workaround above. – Guy Sep 13 '15 at 01:54
  • 3
    In my case, SwiftSupport/iphoneos/ is empty. – Lim Thye Chean Sep 13 '15 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 '15 at 21:25
  • I'm getting this issue on Xcode 7 final and the above not working. – KVISH Sep 17 '15 at 21:57
  • I've been failing to get my build up with the Final release of xcode 7. I tried this and managed to get it working sweet! thanks – bevbomb Sep 18 '15 at 06:53
  • 2
    hey thanks for this! I'm still getting a warning about API analysis file too large http://cl.ly/image/0s0N0s441s0X -- but the important thing is that it still passed and was able to get into TestFlight. – ded Sep 18 '15 at 17:48
  • In no. 5 "from Organizer" means Application Loader won't work? – Vladimir Shutyuk Sep 21 '15 at 11:14
  • After applying this, the app is taking forever to process... Still "Processing", I'm not sure if it's going to be processed at all ! – Hatem Alimam Sep 22 '15 at 15:33
  • This method has stopped working for me, however the answer provided by DJ Tarazona is working now. – Joped Sep 24 '15 at 17:47
  • How could you even discover this :) – osrl Nov 20 '15 at 19:51
  • 1
    What should I do if there is no folder SwiftSupport/iphoneos/ inside my .ipa? – Alexander Yakovlev Nov 25 '15 at 10:04
  • i'm facing the same issue in tvOS, and in tvOS there is no option of bit code in build option. please provide me proper guidance – Pritesh Mar 08 '16 at 06:53
  • Thanks your solution worked for one of my IPA files. But for other IPA, got below error. Any suggestions? "Invalid Swift Support - The file .DS_Store doesn’t have a signing ID. Sign the file, rebuild your app using the current public (GM) version of Xcode, " – Suresh Durishetti Dec 14 '17 at 12:50
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!

Community
  • 1
  • 1
DJ Tarazona
  • 1,769
  • 14
  • 18
  • 4
    This worked for me. Just a heads up, if you run pod-install or pod-update you may have to comment it again! – Max Alexander Sep 22 '15 at 05:25
  • Cocoapods issue here: https://github.com/CocoaPods/CocoaPods/issues/4188, you can try this PR: https://github.com/CocoaPods/CocoaPods/pull/4221 with those instructions: https://guides.cocoapods.org/using/unreleased-features – ldiqual Sep 22 '15 at 21:07
  • updated cocoaPods 0.39.0 and it does not resolve this issue for me – nwales Dec 14 '15 at 16:56
  • @DJ Tarazona Thanks for your recipe!! it totally did the trick for me, even when i did update the cocopods gem to the latest version – Jorge Vicente Mendoza Feb 23 '16 at 16:27
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.

Eneko Alonso
  • 18,884
  • 9
  • 62
  • 84
Will Y
  • 181
  • 3
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

Zhong Huiwen
  • 889
  • 13
  • 10
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.

orkenstein
  • 2,810
  • 3
  • 24
  • 45
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
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
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...

Urkman
  • 1,298
  • 1
  • 16
  • 32
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.

JAL
  • 41,701
  • 23
  • 172
  • 300
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.

jarora
  • 5,384
  • 2
  • 34
  • 46