3

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

as diu
  • 1,010
  • 15
  • 31
  • please paste the relevant bunch of lines on your question. – Suh Fangmbeng Sep 21 '19 at 13:44
  • 1
    updated post, it is just one line.. the pattern is the same and it repeats 19 times, but it is always the same variable `BaseUrl` replace with `resetUrl` – as diu Sep 21 '19 at 13:46
  • are your sure you have all curly braces `{` and `}` done correctly. Make sure each opening has a closing to any block of code. Take your time – Suh Fangmbeng Sep 21 '19 at 13:46
  • Are you able to install the debug build in Real Device(armv64)? – Shahrukh Alam Sep 21 '19 at 14:04
  • @ShahrukhAlam yes, I am able to install and run this on a real device as well as a simulator – as diu Sep 21 '19 at 15:51
  • Hmm weird, Code looks fine to me, did you try just to build if that gives the same error: `xcodebuild clean -workspace YOUR_WORKSPACE.xcworkspace -scheme YOUR_SCHEME` – Shahrukh Alam Sep 23 '19 at 00:55
  • @asdiu did you solve this ? – el3ankaboot Jun 18 '20 at 11:42
  • Hello @asdiu I had the same issue today, used an another struct in other struct. Everything was working only when I achieved it I had this error like yours. I could not find any solution instead removed struct – rozeri dilar Feb 16 '21 at 22:02

1 Answers1

1

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.

Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71