objective-c 无效的 Swift 支持 / SwiftSupport 文件夹为空

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32559204/
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-09-03 21:35:56  来源:igfitidea点击:

Invalid Swift Support / The SwiftSupport folder is empty

objective-cswiftios9xcode7

提问by Tsuyoshi Endo

Environment: Xcode 7 GM

环境:Xcode 7 GM

I uploaded iOS app successfully using Xcode without error. This app is written in Objective-C and Swift.

我使用 Xcode 成功上传了 iOS 应用程序,没有错误。这个应用程序是用 Objective-C 和 Swift 编写的。

However, immediately after successful upload, I got this email from Apple stating this error:

但是,在成功上传后,我立即收到了来自 Apple 的电子邮件,说明了此错误:

Invalid Swift Support - We have discovered one or more issues with your recent delivery for XXXXX(my app name). To process your delivery, the following issues must be corrected:

Invalid Swift Support - The SwiftSupport folder is empty. Rebuild your app using the current public (GM) version of Xcode and resubmit it.

Once these issues have been corrected, you can then redeliver the corrected binary.

Swift 支持无效 - 我们发现您最近交付的 XXXXX(我的应用程序名称)存在一个或多个问题。要处理您的交货,必须更正以下问题:

Swift 支持无效 - SwiftSupport 文件夹为空。使用当前公共 (GM) 版本的 Xcode 重建您的应用程序并重新提交。

更正这些问题后,您就可以重新交付更正后的二进制文件。

Anybody has a solution against this issue?

有人对这个问题有解决方案吗?

I have already confirmed below issues.

我已经确认了以下问题。

"SwiftSupport/iphoneos/" libraries in archives(.xcarchive file) is equaly to "Products/Applications/myApp.ipa/Frameworks/"

档案中的“SwiftSupport/iphoneos/”库(.xcarchive 文件)等同于“Products/Applications/myApp.ipa/Frameworks/”

My "Valid Architectures" setting is "$(ARCHS_STANDARD)" displaying "armv7k".

我的“有效架构”设置是“$(ARCHS_STANDARD)”,显示“armv7k”。

Provisioning profile is set to Dev and Release which has been created in iTunes connect, respectively.

配置文件分别设置为在 iTunes Connect 中创建的 Dev 和 Release。

And, in my "Edit scheme", Test target is unchecked at Archive.

而且,在我的“编辑方案”中,存档中未选中测试目标。

回答by Lixu

important note: this only works for projects that do notuse swift, see commentbelow

重要说明:这仅适用于使用 swift 的项目,请参阅下面的评论

I just met the same issue and resolved it by making the following change - If you used to have Swift files in your project but then removed them, you only need to set "Embedded Content Contains Swift Code" to NO in Build Options.

我刚刚遇到了同样的问题,并通过进行以下更改来解决它 - 如果您曾经在项目中包含 Swift 文件但后来删除了它们,则只需在构建选项中将“嵌入式内容包含 Swift 代码”设置为 NO。

回答by jdhuang

when try to export after "Xcode->Product->Archive" you should choose "save for ios app store deployment" option

在“Xcode->Product->Archive”之后尝试导出时,您应该选择“保存为 ios 应用商店部署”选项

The same problem confused me a couple of days, the above setting can solve this problem.

同样的问题困扰了我几天,上面的设置可以解决这个问题。

no matter "embedded content contains swift code" is yes or no.

无论“嵌入的内容包含快速代码”是或否。

回答by abbood

There are many conflicting answers on this page.. what worked for me was the one mentioned here, which is simply select a save for iOS app store deployment option (I'm actually not interested in an app store release.. I want to simply push a release for testflight internal testing)..

此页面上有许多相互矛盾的答案.. 对我有用的是这里提到的那个,它只是选择保存 iOS 应用商店部署选项(我实际上对应用商店发布不感兴趣。我只想简单地为 testflight 内部测试推送一个版本)。

that being said, I have a way to verify that your ipa will be approved or not before submitting it:

话虽如此,我有一种方法可以在提交之前验证您的 ipa 是否会被批准:

  • drag the .ipa file into a new folder (call it analysis)
  • right click the ipa file and rename it to .zip (confirm the dialog to use .zip)
  • double click the zip file
  • 将 .ipa 文件拖到一个新文件夹中(称之为分析)
  • 右键单击 ipa 文件并将其重命名为 .zip(确认对话框使用 .zip)
  • 双击 zip 文件

here if you get a folder (with the same name as the .ipa file) that has the following subfolders in it:

如果您得到一个文件夹(与 .ipa 文件同名),其中包含以下子文件夹:

  • payload
  • swiftSupport
  • Symbols
  • 有效载荷
  • 迅捷支持
  • 符号

enter image description here

在此处输入图片说明

then you are good to go, however if you only see the Payloadfolder within.. then you gotta try again

那么你很高兴去,但是如果你只看到里面的Payload文件夹..那么你必须再试一次

also a couple of pointers

还有一些提示

  • I've tried setting "Embedded Content Contains Swift Code" to NO, it worked just once then stopped working after that
  • I've ensured that I had no cocoapod errors.. that didn't help either
  • I've tried manually adding the SwiftSupportfolder inside the archive as suggested here.. but then i got all sorts of side effects.. didn't work
  • 我试过将“嵌入式内容包含 Swift 代码”设置为 NO,它只工作了一次,然后就停止工作了
  • 我确保我没有 cocoapod 错误.. 也没有帮助
  • 我已经尝试SwiftSupport按照此处的建议存档中手动添加文件夹.. 但后来我遇到了各种副作用.. 没有用

conclusion

结论

I think this is due to some bug with xcode (writing this with Xcode 8.0 build (8A218a).. so keep on trying your luck until it works.. just don't expect some solid explanation for it

我认为这是由于 xcode 的一些错误(使用 Xcode 8.0 build (8A218a) 编写此代码).. 所以继续尝试你的运气,直到它工作.. 只是不要指望对它有一些可靠的解释

回答by Rein rPavi

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->CommandLines Toolshas the same latest or the same Xcode from drop down selected on which you have done the coding & vola it's done.
  1. 转到构建设置并标记Embedded Content Contains Swift Code-> YES,如果您的代码包含部分 Swift 代码或完全用 Swift 制作
  2. 使用Xcode->Product->Archive 归档您的构建
  3. 导出存档构建你会突然看到不同的构建大小将是 40+ MB 这是因为 XCode 添加了缺少的 SwiftSupport 文件夹
  4. 现在使用应用程序加载器上传此构建
  5. 如果这不起作用,请检查您的系统上是否有多个 XCode 转到 Xcode->Preferences->Location->Command Lines Tools具有相同的最新或相同的 Xcode,从您已完成编码的下拉列表中选择它是完毕。

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

这是一个稍微的缺点,因为 swift 携带着包袱,并且必须与早期版本和 Objective C 代码兼容。

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

我的很多时间都被浪费了,希望你会觉得这有帮助;)

回答by Jon N

This error can happen if you use xcodebuild to export the IPA without specifying the -exportOptionsPlist option

如果您使用 xcodebuild 导出 IPA 而不指定 -exportOptionsPlist 选项,则可能会发生此错误

See xcodebuild -helpfor the available keys, but you probably want a plist with at least the method key set to "app-store", like this:

查看xcodebuild -help可用的键,但您可能需要一个至少将方法键设置为“app-store”的 plist,如下所示:

<?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>method</key>
    <string>app-store</string>
</dict>
</plist>

回答by Ken

I grappled with this for several hours and here is what worked for me.

我解决了几个小时,这对我有用。

In the Archive, Xcode did not copy swift libs into SwiftSupport/iphoneoseven though my project had "Embedded Content Contains Swift Code" set to yes for all targets. Nor did it copy swift libs into "AppName.app/Frameworks". So I had to do that manually in the Archive before submitting:

在存档中,即使我的项目已将所有目标的“ ”设置为“是” ,Xcode 也不会将swift 库复制到SwiftSupport/iphoneosEmbedded Content Contains Swift Code。它也没有将 swift libs 复制到"AppName.app/Frameworks" 中。因此,我必须在提交之前在存档中手动执行此操作:

copy "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/lib*"to"Archive_folder/Products/Applications/AppName.app/Frameworks" and "SwiftSupport/iphoneos"

复制"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/lib*""Archive_folder/Products/Applications/AppName.app/Frameworks" and "SwiftSupport/iphoneos"

If your app also has a watch app

如果您的应用也有手表应用

copy

复制

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos" into "Archive_folder/SwiftSupport/watchos"and"Archive_folder/Products/Applications/AppName.app/Watch/AppName WatchKit App.app/Frameworks"

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos" into "Archive_folder/SwiftSupport/watchos""Archive_folder/Products/Applications/AppName.app/Watch/AppName WatchKit App.app/Frameworks"

Then submit the app.

然后提交应用程序。

回答by T_coder

I spent almost an entire day on this issue, none of the above solutions worked. I got rid of this error by lowering my target tvOS back to 11 from 13; where it was originally. That restored the SwiftSupport folder. The question that remains to be answered is whether this is due to our Provision not allowing us to target tvOS 13 - or somehow the Apple Store folks not being aligned with the xCode folks because the app created by targeting tvOS 13 is 14mb and tvOS 11 is 44mb and different app folder structure.

我在这个问题上花了几乎一整天的时间,上述解决方案都没有奏效。我通过将我的目标 tvOS 从 13 降低到 11 来摆脱这个错误;原来的地方。这恢复了 SwiftSupport 文件夹。有待回答的问题是,这是否是因为我们的 Provision 不允许我们针对 tvOS 13 - 或者 Apple Store 的人没有与 xCode 的人保持一致,因为通过针对 tvOS 13 创建的应用程序是 14mb 而 tvOS 11 是44mb 和不同的应用程序文件夹结构。

回答by Alexander Vasenin

Using Save for iOS App Store Deploymentinstead of Save for Ad Hoc DeploymentXcode export option solved this issue for me. Counterintuitively, you should use the first option even for TestFlight builds.

使用Save for iOS App Store Deployment代替Save for Ad Hoc DeploymentXcode 导出选项为我解决了这个问题。与直觉相反,即使对于 TestFlight 构建,您也应该使用第一个选项。

回答by Blank

Setting "Embedded Content Contains Swift Code"to $(inherited)worked for me. The warning after executing the CocoaPods command pod installhelped me to find this out.

设置“嵌入式内容包含银行代码”$(inherited)对我来说有效。执行 CocoaPods 命令后的警告pod install帮助我找到了这一点。

[!] The `applewatch Extension [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-applewatch Extension/Pods-applewatch Extension.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or  <--------------
- Remove the build settings from the target.

回答by Ken

Here's what I am doing now to solve this issue since my method above stopped working. Keep in mind that my code's main app is Obj-C and my watch app is Swift.

这是我现在正在做的事情来解决这个问题,因为我上面的方法停止工作。请记住,我的代码的主应用程序是 Obj-C,而我的手表应用程序是 Swift。

  1. Make sure the "embedded Content Contains Swift Code" is set to:
    • YES for app target
    • NO for WatchKit Extension
    • YES for Watchkit App
  2. After Archiving my XCode will not create the "[archive folder]/SwiftSupport/iphoneos", but will create and fill the "[archive folder]/Products/Applications/[app name].app/Watch/\ WatchKit\ App.app/Frameworks" with the Swift dylibs. So I created the following soft link:

    ln -s "[archive folder]/Products/Applications/.app/Watch/\ WatchKit\ App.app/Frameworks" "[archive folder]/SwiftSupport/iphoneos"

  1. 确保“嵌入的内容包含 Swift 代码”设置为:
    • 是应用目标
    • WatchKit 扩展的 NO
    • 是的 Watchkit 应用程序
  2. 存档后,我的 XCode 不会创建“[存档文件夹]/SwiftSupport/iphoneos”,而是创建并填充“[存档文件夹]/Products/Applications/[应用名称].app/Watch/\ WatchKit\ App.app /Frameworks”与 Swift dylib。所以我创建了以下软链接:

    ln -s "[存档文件夹]/Products/Applications/.app/Watch/\WatchKit\App.app/Frameworks" "[存档文件夹]/SwiftSupport/iphoneos"

Then when I submit via XCode Organize it is accepted without error.

然后当我通过 XCode Organize 提交时,它被接受而没有错误。

If you simply copy the files rather than linking them then you risk the watch app exceeding the 50MB limit.

如果您只是简单地复制文件而不是链接它们,那么手表应用程序可能会超过 50MB 的限制。