ios xcodebuild在Xcode 15.0中出现#Preview宏失败

jm2pwxwz  于 12个月前  发布在  iOS
关注(0)|答案(1)|浏览(233)

我注意到在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创建一个全新的应用程序项目
1.运行上面的命令
如果我在ContentView.swift中注解掉默认的#Preview语句,同样的命令会顺利通过。

lfapxunr

lfapxunr1#

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

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

字符串

相关问题