xcode 什么是 libswiftRemoteMirror.dylib,为什么它包含在我的应用程序包中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39480526/
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
What is libswiftRemoteMirror.dylib and why is it being included in my app bundle?
提问by Orion Edwards
I've got an iOS app which I've recently switched to Xcode 8. As part of that we switched from swift 2.2 to 2.3 (swift 3 will come later).
我有一个 iOS 应用程序,我最近切换到 Xcode 8。作为其中的一部分,我们从 swift 2.2 切换到 2.3(swift 3 将在稍后推出)。
I've got an automated build pipeline which essentially runs xcodebuild
to produce a release binary on a dedicated build machine, and after I sorted all that out (Xcode 8's automatic code signing really screws everything up), now when I upload my app to iTunes connect, it fails with this error:
我有一个自动构建管道,它基本上运行xcodebuild
以在专用构建机器上生成一个发布二进制文件,在我整理完所有这些之后(Xcode 8 的自动代码签名真的把一切都搞砸了),现在当我将我的应用程序上传到 iTunes 连接,它失败并出现此错误:
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'MyApp.app/libswiftRemoteMirror.dylib' is not permitted. Your app can't contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structurefor information on the iOS app bundle structure."
错误 ITMS-90171:“无效的捆绑结构 - 不允许使用二进制文件 'MyApp.app/libswiftRemoteMirror.dylib'。您的应用程序不能包含独立的可执行文件或库,除了支持的捆绑包的 CFBundleExecutable。请参阅捆绑编程https://developer.apple.com/go/?id=bundle-structure上的指南,了解有关 iOS 应用程序包结构的信息。”
Sure enough, if I unzip the .ipa file and have a look, there's libswiftRemoteMirror.dylib
sitting there.
果然,如果我解压 .ipa 文件并看一看,它就在libswiftRemoteMirror.dylib
那里。
If I archive/export for iTunes via Xcode, then it produces an app bundle which does not have libswiftRemoteMirror.dylib
, however all other builds of my app appear to have it. Even just doing a debug build within Xcode, then looking at the output shows that libswiftRemoteMirror.dylib is sitting in my app's bundle, indicating that Xcode itself is definitely putting it there, not any part of my automated build script.
如果我通过 Xcode 为 iTunes 存档/导出,那么它会生成一个没有 的应用程序包libswiftRemoteMirror.dylib
,但是我的应用程序的所有其他版本似乎都有它。即使只是在 Xcode 中进行调试构建,然后查看输出也会显示 libswiftRemoteMirror.dylib 位于我的应用程序包中,这表明 Xcode 本身肯定将它放在那里,而不是我的自动构建脚本的任何部分。
What is this file, why is it being put there, and what should I do about it? I can modify my build script to delete this file for release builds, but I'm concerned that might affect the code signing process. I'll try it anyway and see what happens, but it feels like that's not quite the right thing to be doing.
这个文件是什么,为什么放在那里,我应该怎么做?我可以修改我的构建脚本以删除此文件以进行发布构建,但我担心这可能会影响代码签名过程。无论如何我都会尝试一下,看看会发生什么,但感觉这不是正确的做法。
Any advice would be appreciated.
任何意见,将不胜感激。
采纳答案by Orion Edwards
I could never get command line xcodebuild to ever work with automatic code signing. I assume because the automated build machine runs as a different account which is only accessed via SSH - It's never had "full" Xcode run as that user account and it doesn't have any certificates in it's Login keychain or anything like that.
我永远无法让命令行 xcodebuild 与自动代码签名一起工作。我假设是因为自动构建机器作为一个不同的帐户运行,该帐户只能通过 SSH 访问 - 它从来没有以该用户帐户的身份运行过“完整”的 Xcode,并且它的登录钥匙串或类似的东西中没有任何证书。
I didn't want to use something like shenzhen
because I've had nothing but bad experiences from those kinds of things in the past. The Xcode build system is complicated and fragile enough without having to add in more scripts and things that could go wrong or out of date.
我不想使用类似的东西,shenzhen
因为过去我除了这些事情的糟糕经历之外什么都没有。Xcode 构建系统足够复杂和脆弱,无需添加更多脚本和可能出错或过时的内容。
Here's what I ended up doing to fix the problem (it's horrible, but it was the only thing I could find that made it work in the end)
这是我最终为解决问题所做的事情(这很可怕,但这是我能找到的唯一使其最终起作用的方法)
In the automated build script, edit the
.pbxproj
to search and replaceProvisioning Style = Automatic;
withProvisioning Style = Manual;
. Also replaceiOS Developer
withiOS Distribution
for the code signing stuff in the same pbxproj file. These two things turn off automatic signingRun
xcodebuild
to build (but not archive) the project in the same way I did in Xcode7 . Xcode compiles the app and signs it, but it's not valid yet, as it containslibswiftRemoteMirror.dylib
and also for some reason hasn't got any entitlements fileDelete
libswiftRemoteMirror.dylib
from the app bundle (this invalidates the signature)Generate an
Entitlements.plist
in the app bundle folder by extracting the entitlements bit from the provisioning profile (Like what BlackBerry's SWSiOSResign.shscript does)Re-sign the app bundle using
codesign --entitlements <file>
From there, use a similar technique to what
bq/package_ipa.sh
does and copy the SwiftSupport folder, then zip the file into anipa
.
在自动构建脚本中,编辑
.pbxproj
以搜索并替换Provisioning Style = Automatic;
为Provisioning Style = Manual;
。同时更换iOS Developer
与iOS Distribution
在同一pbxproj文件中的代码签名的东西。这两件事关闭自动签名xcodebuild
以我在 Xcode7 中所做的相同方式运行以构建(但不归档)项目。Xcode 编译应用程序并对其进行签名,但它还无效,因为它包含libswiftRemoteMirror.dylib
并且由于某种原因还没有任何权利文件libswiftRemoteMirror.dylib
从应用程序包中删除(这会使签名无效)Entitlements.plist
通过从配置文件中提取权利位在应用程序包文件夹中生成一个(就像黑莓的 SWSiOSResign.sh脚本所做的那样)使用重新签署应用程序包
codesign --entitlements <file>
从那里,使用
bq/package_ipa.sh
与复制 SwiftSupport 文件夹类似的技术,然后将文件压缩到ipa
.
I couldn't actually use package_ipa.sh
file, I needed to re-implement similar logic instead because I need to reference Swift_2.3.toolchain
to get the SwiftSupport from as my app is still swift 2.3 - not XcodeDefault.toolchain
(which is swift 3)
我实际上无法使用package_ipa.sh
文件,我需要重新实现类似的逻辑,因为我需要引用Swift_2.3.toolchain
以从中获取 SwiftSupport,因为我的应用程序仍然是 swift 2.3 - 不是XcodeDefault.toolchain
(这是 swift 3)
It seems like I should be able to use xcodebuild --archive
in combination with some other things to avoid some of these steps. I could never get that to work under Xcode7, but I might try again with XC8 if I have time
似乎我应该能够xcodebuild --archive
与其他一些东西结合使用来避免其中的一些步骤。我永远无法让它在 Xcode7 下工作,但如果我有时间,我可能会用 XC8 再试一次
回答by u2041954
In my case I got ERROR ITMS-90171 because I am using custom frameworks.
就我而言,我收到 ERROR ITMS-90171 错误,因为我使用的是自定义框架。
"Invalid Bundle Structure - The binary file 'MyFramework.framework/libswiftRemoteMirror.dylib'
“无效的捆绑结构 - 二进制文件‘MyFramework.framework/libswiftRemoteMirror.dylib’
(I didn't get it for my application.)
(我的申请没有得到它。)
I tried gym but it got stuck at xcrun. So I tried doing rm -rf libswiftRemoteMirror
in the build phrase (with a custom run-script) for every custom framework I have and interestingly I didn't break anything: it worked.
我尝试过健身房,但它卡在 xcrun 上。所以我尝试rm -rf libswiftRemoteMirror
在构建短语(使用自定义运行脚本)中为我拥有的每个自定义框架做,有趣的是我没有破坏任何东西:它有效。
回答by Art
Recently started using Swift for our project and got same error.
最近开始在我们的项目中使用 Swift 并遇到同样的错误。
To find a root cause, I just did 'grep -Ril "libswiftRemoteMirror" .' in XCode.app (I have 10.1 currently) and found ./Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/XCLanguageSupport.xcplugin/Contents/Resources/swift-stdlib-tool.xcspec file. It says:
为了找到根本原因,我只是做了 'grep -Ril "libswiftRemoteMirror" 。在 XCode.app 中(我目前有 10.1)并找到 ./Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/XCLanguageSupport.xcplugin/Contents/Resources/swift-stdlib-tool。 xcspec 文件。它说:
// SWIFT_RESOURCE_DESTINATION and SWIFT_RESOURCE_LIBRARY allow us to copy
// libswiftRemoteMirror.dylib into place so that memory debugging tools have access to it
// on device.
// We disable these options in "DEPLOYMENT" modes, so that the libswiftRemoteMirror.dylib
// does not make its way into archives submitted to the App Store.
So solution is simple - in XCode target settings set Deployment Postprocessing to Yesfor your Release configuration (or whatever you use for build)
所以解决方案很简单 -在 XCode 目标设置中,为您的发布配置(或您用于构建的任何内容)设置部署后处理为是
回答by Fizker
I ran into the same problem after installing Xcode 8, by building via shenzhen.
安装 Xcode 8 后,我遇到了同样的问题,通过构建通过shenzhen。
I decided to look at Fastlaneas an alternative, and their gym
program produces an ipa that can be submitted to Apple.
我决定将Fastlane作为替代方案,他们的gym
程序生成了一个可以提交给 Apple 的 ipa。
It was reasonably easy for me to replace the call to ipa
(shenzhen's executable) with a call to gym
, and the rest of my build-and-upload scripts worked without modifications.
对我来说,用对 的调用替换对ipa
(深圳的可执行文件)的调用相当容易gym
,并且我的其余构建和上传脚本无需修改即可运行。
If you prefer to build directly, I lifted the following from the gym
readme. It produces an .xcarchive
containing an .app
file without the libswiftRemoteMirror.dylib
. I don't use that kind of flow myself, so I can't say how you would proceed from there.
如果您更喜欢直接构建,我从gym
自述文件中提取了以下内容。它生成一个.xcarchive
包含.app
没有libswiftRemoteMirror.dylib
. 我自己不使用那种流程,所以我不能说你会如何从那里进行。
xcodebuild \
-scheme Scheme \
-workspace Project.xcworkspace \
-configuration 'Release' \
-destination 'generic/platform=iOS' \
-archivePath './Output.xcarchive' \
archive
回答by Noushad Shah
Just go to the build setting and do as it is your problem will resolve.
只需转到构建设置,然后按照您的问题即可解决。
回答by Kalpesh Muthe
just Archive your build from Xcode right click on archive file -> show in finder -> right click -> show package content -> product -> appliction -> copy .app file generate payload & upload using Application Loader. It help in my case.
只需从 Xcode 存档您的构建,右键单击存档文件 -> 在 finder 中显示 -> 右键单击 -> 显示包内容 -> 产品 -> 应用程序 -> 复制 .app 文件生成有效负载并使用应用程序加载器上传。它对我有帮助。