iosswiftxcodeswifty-json

xcodebuild no such module 'SwiftyJSON' while build in xcode works


In my project, I'm using CocoaPods and podfile looks like this:

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:

error: no such module 'SwiftyJSON'
import SwiftyJSON

I have tried reinstalling SwiftyJSON and upgrading it to a new version. Also tried to manually add SwiftyJSON.framework to 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


Solution

  • Found a solution, it was a silly mistake. Unlike from OSX file system, xcode seems to be case sensitive. 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 gym --configuration Test ...