CompileSwift normal arm64 when using `xcodebuild` to archive

5.6k Views Asked by At

Issue: getting the following error in terminal when archiving

The following build commands failed:

CompileSwift normal arm64

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler

Steps to reproduce: xcodebuild -workspace playmule.xcworkspace -scheme playmule -sdk iphoneos -archivePath ~/Desktop/playmule.xcarchive -configuration playmule archive

The following are a bunch of lines before ** ARCHIVE FAILED ** : (see below)

/Users/ss/Desktop/playmule-ios/playmule/Utility/NetworkManager.swift:174:25: error: type 'Constants.Api' has no member 'BaseUrl'; did you mean 'resetUrl'? let urlString = Constants.Api.BaseUrl + Constants.Api.currentVersion + Constants.Api.resendSMSEndpoint ^~~~~~~~~~~~~ ~~~~~~~ resetUrl

This same error is repeated for the same static variable. The variable is confirmed to be present in the struct as below:

struct Constants {
  struct Api {
    static let BaseUrl = "https://some-valid-url.com/dev/"
  }
} 

EDIT: I am able to run this project on a device and a simulator. So the issue is unrelated to code semantics

1

There are 1 best solutions below

0
Pranav Kasetti On

I made a small tweak to my xcodebuild command with -parallelizeTargets to resolve build errors for projects with frameworks/linked dependency targets:

xcodebuild -workspace playmule.xcworkspace -scheme playmule -sdk iphoneos -archivePath ~/Desktop/playmule.xcarchive -parallelizeTargets archive

Note that the above flag also helps compile other actions with xcodebuild such as build or docbuild.