ios 无效的 Swift 支持/无效的 Swift 实现

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26163856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:58:53  来源:igfitidea点击:

Invalid Swift Support / invalid implementation of swift

iosxcodeswiftapp-store-connect

提问by Simon Meyborg

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:

我想上传一个用 swift 编写的应用程序。应用程序加载器成功交付应用程序,但几分钟后我收到了苹果的回复:

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.

无效的 Swift 支持 - 该包包含无效的 Swift 实现。该应用程序可能是使用不合规或预发布工具构建或签名的。访问 developer.apple.com 了解更多信息。

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

我使用 xCode 版本 6.0.1 (6A317)、Swift iOS SDK 8.0 并使用 xcode 构建应用程序。

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

我在哪里可以找到有关如何有效实现 swift 的任何信息?苹果没有说任何具体的东西。

Thx

谢谢

回答by Kevin Delord

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

我有一个类似的问题。为了修复它并能够将构建推送到 iTunesConnect,我必须执行以下操作:

  • Set the flag EMBEDDED_CONTENT_CONTAINS_SWIFTto YESin the target settings
  • Be sure that Build Phases did not include any other weird targets
  • Logoutall Apple Developper accounts from Xcode and login with just the one you want to push the app with.
  • Archive and submit the app with Xcodeand NOTwith Application Loader.
  • 该标志设置EMBEDDED_CONTENT_CONTAINS_SWIFTYES在目标设置
  • 确保构建阶段不包括任何其他奇怪的目标
  • Logout来自 Xcode 的所有 Apple Developper 帐户,然后仅使用您想要推送应用程序的帐户登录
  • 存档并提交应用程序,with Xcode不是使用 Application Loader。

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

为什么我需要退出所有 Apple Developper 帐户?

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

因为 Xcode 不知道使用哪个帐户来上传二进制文件。Application Loader 一开始就问你,但是上传的构建无效......

UPDATE:

更新:

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

Xcode 7.1和新版本的 Swift 开始,我再次收到错误消息。当前的解决方法是执行以下操作:

  • Create an archive locally on Xcode (does not work on my CI)
  • On Organizer, exportit as an AppStore build.
  • Use Application Loader to upload the binary.
  • 在 Xcode 本地创建存档(不适用于我的 CI)
  • 在 Organizer 上,导出为 AppStore 版本。
  • 使用 Application Loader 上传二进制文件。

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

几分钟 (~10) 后,该版本应该可以在 iTunesConnect 上使用。

回答by cl3m

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.shand commenting the block after

如果您使用 Swift pods,问题可能来自 cocoapods。要修复它,请使用分支xcode7-invalid-swift-support-fix( usage)。或者通过编辑Pods/Target Support Files/Pods/Pods-frameworks.sh并在之后注释块来手动完成

 # Embed linked Swift runtime libraries

More info:

更多信息:

回答by Vinh Huynh

Solution for xcodebuild

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).
  • 创建一个临时文件夹

  • 将 ipa 文件解压到临时文件夹

  • 在临时文件夹中创建 SwiftSupport 文件夹
  • 将 swift libs 从 Payload/*app/frameworks 复制到 SwiftSupport 文件夹
  • 打包 ipa 文件包含在 temp 文件夹中(我们有 Payload 和 SwiftSupport 文件夹)。

Here my shell script for add Swift libs to ipa

这是我的 shell 脚本,用于将 Swift 库添加到 ipa

https://github.com/huhuvipi/VH_ipa_packger

https://github.com/huhuvipi/VH_ipa_packger

If you existing ipa file , you just:

如果您现有 ipa 文件,您只需:

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

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

回答by savage7

Do you build with command line (xcodebuild)?

您是否使用命令行(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.

如果是这样:我遇到了同样的问题。问题是生成的ipa文件无效。它缺少 SwiftSupport 文件夹。该文件夹是在使用 Xcode Gui 构建 Swift 项目时由 XCode 添加的。

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

这个问题在这个苹果开发者论坛线程中描述,并参考了一个开放的雷达票:https: //devforums.apple.com/message/1042117#1042117

回答by Antonio

Do you have any other version of Xcode installed?

您是否安装了任何其他版本的 Xcode?

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.

打开您最新的 Xcode,然后转到首选项(Xcode 菜单 -> 首选项),切换到位置选项卡并验证命令行工具是否与您的 Xcode 版本匹配。

回答by Franklin Lino

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

我遇到了同样的问题并尝试了所有建议的方法,但总是失败......我的应用程序生成了 SwiftSupport 文件夹,我刚刚用这个解决方案解决了:

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.

感谢您发送该 .ipa 文件。该问题是由 SwiftSupport 目录中的 libswiftXCTest.dylib 引起的。该 dylib 由测试目标使用,并且对于开发构建包含是正常的,但 App Store 的存档构建不应包含此 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
  1. 打开你的 Xcode 项目
  2. 选择产品 > 方案 > 编辑方案
  3. 单击左侧边栏中的构建
  4. 对于您的测试目标,取消选中存档复选框
  5. 单击关闭按钮
  6. 选择产品 > 存档
  7. 将最新存档提交到 App Store

回答by Drew

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

如果您是通过xcodebuild或 Xcode Server(或 Xcode 中的 Organizer 窗口以外的任何内容)构建,则缺少 IPA SwiftSupport。请参阅此问题的讨论

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

解决方案本质上是自己导出 IPA。 CaveJohnson有一个命令可以使用正确的 SwiftSupport 导出 IPA,因此您可以像这样构建 IPA:

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

回答by jmcastel

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.

检查您的代码签名。我在使用自动签名时遇到了这个错误。我把我的开发配置文件和生产配置文件放在发布版本中,错误消失了。

回答by Hardik Shah

Simple Solution :

简单的解决方案:

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

嗨,我有同样的问题,以下是解决方案:

Just Set the flag EMBEDDED_CONTENT_CONTAINS_SWIFTto NOin the build setting of Target,Project and everywhere like testTarget as well.

只需在 Target、Project 和 testTarget 等任何地方的构建设置中设置标志EMBEDDED_CONTENT_CONTAINS_SWIFT即可NO

回答by Gerrit Post

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.

我试图将 EMBEDDED_CONTENT_CONTAINS_SWIFT 的标志设置为 YES 和 NO。两者都不适合我。

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

最终我用 Drew 提到的 CaveJohnson 尝试了它。但这也不起作用。

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

最后我创建了一个新项目并插入了我的 swift 文件和框架等。就是这样!

The solution in my case: Create a new project

我的解决方案:创建一个新项目