xcodebuild 在 Xcode 15.0 中使用 #Preview 宏失败

问题描述 投票:0回答:2

我注意到,在 Xcode 15.0 中,除非我从应用程序中删除

xcodebuild
宏,否则用于存档应用程序的
#Preview
命令会失败。

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

错误是:

{
  "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 initialize\n\/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 here\n@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 **

如何重现:

  1. 使用 Xcode 15.0 RC 创建一个全新的应用程序项目
  2. 运行上面的命令

如果我注释掉

#Preview
中的默认
ContentView.swift
语句,相同的命令会完美地通过。我错过了什么?

ios xcode xcode15
2个回答
0
投票

并不是一个完整的解决方案,但这个命令让我解决了同样的问题:

defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES

0
投票

确实,我也有同样的问题。 当看到下面的网址时,问题就解决了。 前往以下页面。

如何在M1/M2 Mac终端中快速切换arm64或x86架构?

© www.soinside.com 2019 - 2024. All rights reserved.