Invalid Swift Support / invalid implementation of swift

IosXcodeSwiftApp Store-Connect

Ios Problem Overview


I'd like to upload an app written in swift. Application loader delivers the app successfully, but after a few minutes I get a reply by apple telling:

> Invalid Swift Support - The bundle contains an invalid implementation of Swift. The app may have been built or signed with non-compliant or pre-release tools. Visit developer.apple.com for more information.

I use xCode Version 6.0.1 (6A317), Swift iOS SDK 8.0 and just build the app with xcode.

Where can I find any information on how to get a valid implementation of swift? Apple does not say anything concrete.

Thx

Ios Solutions


Solution 1 - Ios

I had a similar problem. To fix it and be able to push a build to iTunesConnect I had to do the following:

  • Set the flag EMBEDDED_CONTENT_CONTAINS_SWIFT to YES in the target settings
  • Be sure that Build Phases did not include any other weird targets
  • Logout all Apple Developper accounts from Xcode and login with just the one you want to push the app with.
  • Archive and submit the app with Xcode and NOT with Application Loader.

Why did I need to logout from all of my Apple Developper accounts?

Because Xcode does not know which account to use to upload the binary. Application Loader ask you in the beginning but then, the uploaded build isn't valid...

UPDATE:

Since Xcode 7.1 and the new versions of Swift I got the error again. The current workaround is to do the following:

  • Create an archive locally on Xcode (does not work on my CI)
  • On Organizer, export it as an AppStore build.
  • Use Application Loader to upload the binary.

After few minutes (~10) the build should be available on iTunesConnect.

Solution 2 - Ios

The problem might come from cocoapods if you are using Swift pods. To fix it, use the branch xcode7-invalid-swift-support-fix (usage). Or do it manually by editing Pods/Target Support Files/Pods/Pods-frameworks.sh and commenting the block after

 # Embed linked Swift runtime libraries

More info:

Solution 3 - Ios

Solution for xcodebuild

  • create a temp folder

  • unzip ipa file to temp folder

  • create SwiftSupport folder inside temp folder

  • copy swift libs from Payload/*app/framworks to SwiftSupport folder

  • package ipa file from contains inside temp folder (we have Payload and SwiftSupport folders).

Here my shell script for add Swift libs to ipa

https://github.com/huhuvipi/VH_ipa_packger

If you existing ipa file , you just:

path/to/package_ipa.sh /path/to/ipafile

Solution 4 - Ios

Do you build with command line (xcodebuild)?

If so: I encountered the same problem. The problem is that the generated ipa file is invalid. It is missing the SwiftSupport folder. The folder is added by XCode when a project with Swift is built with the Xcode Gui.

The problem is described in this apple developer forum thread with a reference to an open radar ticket: https://devforums.apple.com/message/1042117#1042117

Solution 5 - Ios

Do you have any other version of Xcode installed?

Open your latest Xcode, then go to preferences (Xcode menu -> Preferences), switch to the Locations tab and verify that the Command Line Tools matches your Xcode version.

Solution 6 - Ios

If you're building via xcodebuild or Xcode Server (or anything other than the Organizer window in Xcode), the IPA is missing SwiftSupport. See this discussion of the problem.

The solution is essentially to export the IPA yourself. CaveJohnson has a command to export an IPA with the correct SwiftSupport, so you can build an IPA like so:

cavejohnson xcodeGUITricks --archive-path my.xcarchive --new-ipa-path myapp.ipa

Solution 7 - Ios

I was with the same problem and tried everything proposed, but always failed... My apps generates SwiftSupport Folders, I just solved with this solution:

Thank you for sending that .ipa file. The issue is caused by libswiftXCTest.dylib in the SwiftSupport directory. That dylib is used by testing targets and is normal for development builds to include, but an archive build for the App Store should not include this dylib.

In order to resolve this issue, please follow these steps:

  1. Open your Xcode project
  2. Select Product > Scheme > Edit Scheme
  3. Click Build in the left sidebar
  4. For your test target, uncheck the Archive checkbox
  5. Click the Close button
  6. Select Product > Archive
  7. Submit the latest archive to the App Store

Solution 8 - Ios

Check your code signing. I had this error while using automatic signing. I Put my dev profile for dev and production profile for release version and error is gone.

Solution 9 - Ios

Simple Solution :

Hi, I had same issue and below is the solution :

Just Set the flag EMBEDDED_CONTENT_CONTAINS_SWIFT to NO in the build setting of Target,Project and everywhere like testTarget as well.

Solution 10 - Ios

I had this problem too

I tried to set the flag of EMBEDDED_CONTENT_CONTAINS_SWIFT to YES and NO. Both were not working for me.

Eventually I tried it with CaveJohnson mentioned by Drew. But that didn't work either.

At last I created a new project and inserted my swift files and frameworks etc. That was it!

The solution in my case: Create a new project

Solution 11 - Ios

OK, I have been working on this for many hours now and finally found a solution.

To pre-frame the answer here is what I did:

  • tried everything in the previous answers
  • spent an hour on the phone with Apple Tech support.
  • read every Apple developer forum having to do with "invalid swift" in their developer network. Tried each of the proposed solutions.

I finally uninstalled and reinstalled Xcode and what do you know, it works now. Sometimes I don't know why this isn't my first idea for a solution.

Solution 12 - Ios

I discovered that changing "Embedded Content Contains Swift Code" from YES to NO in the main app build settings (and leaving it set to YES in the extension) would run on the watch (and the phone). At the same time as I uploaded that binary, Apple must have made a change to the ITC backend as my other uploaded builds which had been marked "Invalid Binary" reverted to "Processing" and later passed the screen to "Inactive".

So I submitted the build with "Embedded Content Contains Swift Code" YES in the extension only for review.

Main app: Embedded Content Contains Swift Code = YES (if its a swift project. else NO)

WatchKit Extension: Embedded Content Contains Swift Code = YES (if its a swift project. else NO)

WatchKit App: Embedded Content Contains Swift Code = NO (In any case)

Solution 13 - Ios

Here's a solution when using command line http://www.matrixprojects.net/p/xcodebuild-export-options-plist/

Basicly all what needs to be done is to create xcodebuild exportOptions plist file which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>teamID</key>
        <string>MYTEAMID123</string>
        <key>method</key>
        <string>app-store</string>
        <key>uploadSymbols</key>
        <true/>
</dict>
</plist>

Most important key here is method app-store

And then run xcode build with archive

xcodebuild -scheme MyApp -archivePath builds/MyApp.xcarchive archive

After that run xcrun with export archive

xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath builds/MyApp.xcarchive -exportPath builds

Solution 14 - Ios

I was facing same problem . The solution that worked for me was to update my xcode and then create new project and copy paste all my work to that project

Solution 15 - Ios

seriously. I spent two days on this problem, and I tried all methods above. Nothing works!Finall. I used my friend's mac. And this time, it works. After that I realized that I downloaded the xcode from developer center not in mac app store. So I removed all xcode from my mac, and reinstall the xcode from app store, and it worked. And there is no difference between the two versions, which shared the exactly the same version number.

Solution 16 - Ios

After Swift project update in new xcode was getting similar error and below is my solution.

Open project.pbxproj file and remove below line

> EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;

and was able to submit app successfully.

Solution 17 - Ios

We had a similar problem after upgrading to Xcode 7. Had to add the -exportOptionsPlist option and supply method and teamID. Messed things up but works now.

Solution 18 - Ios

Five Step Solution:

  1. Go to build settings and make flag Embedded Content Contains Swift Code -> YES, if your code contains partial swift code or entirely made in Swift
  2. Archive your build using Xcode->Product->Archive
  3. Export the Archive Build you will suddenly see the difference build size will be 40+ MBs this is because XCode has added SwiftSupport folder which was missing
  4. Now upload this build using Application loader
  5. If this does not work check that if you have multiple XCode on your system goto Xcode->Preferences->Location->Command Lines Tools has the same latest or the same Xcode from drop down selected on which you have done the coding & vola it's done.

This is slightly a drawback as swift carries the baggage and has to be compatible with earlier version and Objective C code.

My many hours were wasted hope you will find this helpful ;)

Solution 19 - Ios

Thought I should share since I spent a few days trying to solve this problem.

Everyone keeps saying to set EMBEDDED_CONTENT_CONTAINS_SWIFT = NO or =YES

I had an iPhone app written entirely in Objective-C and a Watch Kit app written entirely in Swift.

I set EMBEDDED_CONTENT_CONTAINS_SWIFT = NO for everything (Project Target, iPhone app target, Tests, UITests, and WatchKit)

The place where I set EMBEDDED_CONTENT_CONTAINS_SWIFT = YES is in the WatchKit Extension. This solved my problem and I was able to upload to the App Store through Xcode.

Hope this can help somebody!

Solution 20 - Ios

I was able to fix this by opening the archive, going into SwiftSupport and deleting the folder for WatchOS because it was empty. I guess my Watch target was set to embed Swift, so it included the folder but didn't generate anything inside it. So iTC saw an empty folder and errors out. By removing the empty folder it worked.

Solution 21 - Ios

For me this is what worked for distribution.

Goto -> Xcode->product->Archive->Export

After this a folder will be created with current date. You can save it somewhere for later use. Then open Application loader and you can submit to the itunesConnect from here. Everything will be cleared. Make sure you create Build(.ipa) file by clicking on Export option in the organizer window. Then use Application loader to submit build to iTunesConnect.

I hope it helps. Let me know if you need more information.

Solution 22 - Ios

If you have cocoapods, simply delete all of the pods and then reinstall pod install.

Very annoying since I have -22421 error when uploading directly from Xcode and Invalid Swift support when using Application Loader

Solution 23 - Ios

I actually just solved this with a completely different, unrelated and really weird fix. Had the above error, but did NOT change anything in the Project or build Environment.

After a lot of Rebuild and Upload Cycles, it turned out that it was an Ad-Hoc certificate that was causing this issue. Using fastlane and setting the gym flag ad_hoc to false as well as using a Release Config for the build (not sure which one fixed it) finally worked. Here is my gym line:

identifier = "de.xxx.yyy"
config = "Release"
ad_hoc = false
scheme = "Schema"
gym(verbose: false, scheme: scheme, codesigning_identity: "iPhone Distribution: YTB)", configuration: config)

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
QuestionSimon MeyborgView Question on Stackoverflow
Solution 1 - IosKevin DelordView Answer on Stackoverflow
Solution 2 - Ioscl3mView Answer on Stackoverflow
Solution 3 - IosVinh HuynhView Answer on Stackoverflow
Solution 4 - Iossavage7View Answer on Stackoverflow
Solution 5 - IosAntonioView Answer on Stackoverflow
Solution 6 - IosDrewView Answer on Stackoverflow
Solution 7 - IosFranklin LinoView Answer on Stackoverflow
Solution 8 - IosjmcastelView Answer on Stackoverflow
Solution 9 - IosHardik ShahView Answer on Stackoverflow
Solution 10 - IosGerrit PostView Answer on Stackoverflow
Solution 11 - IosWade AndersonView Answer on Stackoverflow
Solution 12 - IosCharith NidarshaView Answer on Stackoverflow
Solution 13 - IosKamiltonView Answer on Stackoverflow
Solution 14 - IosFaisal KhalidView Answer on Stackoverflow
Solution 15 - Ioscrazy_phageView Answer on Stackoverflow
Solution 16 - IosSureshView Answer on Stackoverflow
Solution 17 - IosepatelView Answer on Stackoverflow
Solution 18 - IosRein rPaviView Answer on Stackoverflow
Solution 19 - IosMSU_BulldogView Answer on Stackoverflow
Solution 20 - IosJames KuangView Answer on Stackoverflow
Solution 21 - IosNarasimha NallamsettyView Answer on Stackoverflow
Solution 22 - IoskeithicsView Answer on Stackoverflow
Solution 23 - IosBlitzView Answer on Stackoverflow