skip to Main Content

I noticed that in Xcode 15.0, xcodebuild command to archive the app fails unless I remove the #Preview macro from the app.

$ xcodebuild archive -scheme <Your Scheme> -sdk iphoneos -allowProvisioningUpdates -archivePath build.xcarchive

and the error is:

{
  "kind": "finished",
  "name": "compile",
  "pid": 42409,
  "output": "<unknown>:0: warning: compiler plugin not loaded: '/Applications/Xcode-15.0.0-Release.Candidate.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server; fai
led to initializen/Users/xyz/Dev/experiments/fastlane-test/fastlane-test/ContentView.swift:22:1: error: external macro implementation type 'PreviewsMacros.SwiftUIView' could not be found for macro
'Preview(_:body:)'n#Preview {n^nSwiftUI.Preview:2:41: note: 'Preview(_:body:)' declared heren@freestanding(declaration) public macro Preview(_ name: String? = nil, body: @escaping @MainActor () -> View) = #ex
ternalMacro(module: "PreviewsMacros", type: "SwiftUIView")n                                        ^n",
  "process": {
    "real_pid": 42409
  },
  "exit-status": 1
}
** ARCHIVE FAILED **

How to reproduce:

  1. Create a brand new app project with Xcode 15.0 RC
  2. Run the above command

If I comment out the default #Preview statement in the ContentView.swift, the same command passes flawlessly. What am I missing?

2

Answers


  1. Not really a full solution, but this command allowed me to get past the same issue:

    defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
    
    Login or Signup to reply.
  2. Exactly, I had same issue.
    and sloved issue when saw below url.
    Go to the below page.

    How to quickly change between arm64 or x86 architecture in M1/M2 Mac terminals?

    It is CLI command Error’s Keypoint action that adding prefix command (just like "/usr/bin/arch -arm64 xcode build {more Param}…")

    I was modify command archi type -arm64 then everything is well.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search