Xcode 9无法使用Pod构建Swift 4项目 [英] Xcode 9 fails to build Swift 4 project with pod
问题描述
当尝试在Xcode 9 beta 2中构建我的Swift 4项目时,会发生一些代码签名错误,之后我的应用程序的构建将中断。
When attempting to build my Swift 4 project in Xcode 9 beta 2, some code signing error occurs after which the build of my app is discontinued.
该错误是在Xcode中显示:
The error that is shown in Xcode:
/usr/bin/codesign --force --sign - --preserve-metadata=identifier,entitlements '/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework'
/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework: No such file or directory
您可能会注意到,-sign
参数后面是单个-
字符。
As you might notice, the --sign
argument is followed by a single -
character.
我的设置:
- Xcode 9 beta 2(9M137d)及其捆绑的Swift 4版本
- 带有Podfile的Cocoapods v1.2.1
platform :ios, '10.0'
target 'Emprova GPS Demo Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
target 'Emprova GPS Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
- 我没有更改任何已添加的pod文件的单个字母。
- 我打开
Pods.xcodeproj
进行检查并再次检查Build Settings
-代码签名身份
的Alamofire广告连播/目标,但已将其设置为请勿输入代码符号
。 - 我已经检查了我的钥匙串访问应用程序,以查看
Apple全球开发者关系证书颁发机构
是否没有过期(不是)并且被标记为受信任(是)。 - 我已经清空了DerivedData目录多次(
〜/ Library / Developer / Xcode / DerivedData
)并执行了Clean
(都通过Cmd + K
和Cmd + Alt + Shift + K
都无济于事。 - 我已经尝试设置Xcode的命令行工具(
首选项
-位置
-命令行工具
)到两个Xc ode 8.3.3(8E3004b)
和Xcode 9.0(9M137d)
无济于事。
- I didn't change a single letter of any of the added pods files.
- I opened
Pods.xcodeproj
to check and double checkBuild Settings
-Code Signing Identitiy
of the Alamofire pod/target, but it is set toDon't Code Sign
. - I already checked my Keychain Access app to see if the
Apple Worldwide Developer Relations Certification Authority
wasn't expired (it isn't) and is marked as trusted (it is). - I already emptied the DerivedData directory multiple times (
~/Library/Developer/Xcode/DerivedData
) and performed aClean
(both viaCmd+K
andCmd+Alt+Shift+K
to no avail. - I already attempted to set the Xcode 'Command Line Tools' (
Preferences
-Locations
-Command Line Tools
) to bothXcode 8.3.3 (8E3004b)
andXcode 9.0 (9M137d)
to no avail.
花了多个小时寻找解决方案之后,才完全没有想法。有谁知道为什么Xcode 9不再构建我的项目?
Completely ran out of ideas after having spent multiple hours searching for a solution. Does anyone have a clue why Xcode 9 no longer builds my project?
此外,出于完整性考虑,请在Alamofires GitHub页面上链接到我的问题:#2183 。
Also, link to my issue on Alamofires GitHub page, for the sake of completeness: #2183.
推荐答案
我发现了问题所在! Xcode在欢迎屏幕上选择它时,继续使用 .xcodeproj
文件打开我的项目,但是 Cocoapods
要求<要使用code> .xcworkspace 文件!之后,Xcode的欢迎屏幕上的两个条目之间存在视觉上的区别:欢迎屏幕上Xcode工作区与项目之间的差异。
I found out what's wrong! Xcode continued using the .xcodeproj
file to open my project when selecting it on the welcome screen, but Cocoapods
requires the .xcworkspace
file to be used! There's a visual distinction between both entries on Xcode's Welcome screen afterwards: difference between Xcode workspace and project on Welcome screen.
打开工作区将在Xcode的 Project Navigator
中显示两个项目:一个用于我的应用程序,一个用于第二个名为 Pods
,体现了所有已安装的Pod。构建应用程序不再显示奇怪的构建错误。
Opening the workspace shows two projects in Xcode's Project Navigator
: one for my app and a second one named Pods
, which embodies all installed pods. Building the app no longer shows weird build errors.
这篇关于Xcode 9无法使用Pod构建Swift 4项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!