简体   繁体   English

xcodebuild在xcode构建时没有这样的模块'SwiftyJSON'

[英]xcodebuild no such module 'SwiftyJSON' while build in xcode works

In my project, I'm using CocoaPods and podfile looks like this: 在我的项目中,我使用的是CocoaPods,podfile看起来像这样:

def shared_pods
  use_frameworks!

  pod 'SwiftyJSON', '~> 3.1.4'
  pod 'Alamofire', '~> 4.3.0'
  pod 'PromiseKit', '~> 4.4'
end

target 'myop' do
    shared_pods
end

build via xcode works fine , but if I try to build via command line ( xcodebuild tool), I get the following error: 通过xcode构建工作正常 ,但如果我尝试通过命令行(xcodebuild工具)构建,我收到以下错误:

error: no such module 'SwiftyJSON'
import SwiftyJSON

I have tried reinstalling SwiftyJSON and upgrading it to a new version. 我尝试重新安装SwiftyJSON并将其升级到新版本。 Also tried to manually add SwiftyJSON.framework to Build Phases -> Link Binary With Libraries to link . 还尝试手动添加SwiftyJSON.framework到Build Phases - > Link Binary With Libraries to link

Common cause of this error is running project instead of workspace, but I'm not doing this mistake, this is the command I'm running: 这个错误的常见原因是运行项目而不是工作区,但我没有犯这个错误,这是我正在运行的命令:

xcodebuild -workspace ./myproject.xcworkspace -scheme myproject -configuration test -destination 'generic/platform=iOS' -archivePath /Users/boris/Library/Developer/Xcode/Archives/2017-12-13/myproject\ 2017-12-13\ 13.08.14.xcarchive archive

Any help is greatly appreciated. 任何帮助是极大的赞赏。 Thanks 谢谢

Found a solution, it was a silly mistake. 找到了解决方案,这是一个愚蠢的错误。 Unlike from OSX file system, xcode seems to be case sensitive. 与OSX文件系统不同,xcode似乎区分大小写。 Configuration test does not exist, but Test does (First letter is uppercase). 配置测试不存在,但测试确实(第一个字母是大写)。

So the command should go like this: 所以命令应该是这样的:

xcodebuild -configuration Test ...

or if you're using fastlane: 或者如果您使用的是fastlane:

fastlane gym --configuration Test ...

在命令行上执行xcodebuild之前,请先pod install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM