Swift:Jazzy 无法运行 xcodebuild

Posted

技术标签:

【中文标题】Swift:Jazzy 无法运行 xcodebuild【英文标题】:Swift: Jazzy failing to run xcodebuild 【发布时间】:2021-04-14 11:33:00 【问题描述】:

我正在尝试生成一些文档。我的项目使用 Jazzy。但是,当我从命令行运行 jazzy 时,我得到以下输出:

Could not successfully run `xcodebuild`.
Please check the build arguments.
Saved `xcodebuild` log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log
Failed to generate documentation
Traceback (most recent call last):
    7: from /usr/local/bin/jazzy:23:in `<main>'
    6: from /usr/local/bin/jazzy:23:in `load'
    5: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/bin/jazzy:15:in `<top (required)>'
    4: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `build'
    3: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `chdir'
    2: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:81:in `block in build'
    1: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/sourcekitten.rb:266:in `run_sourcekitten'
/usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/executable.rb:36:in `execute_command': /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/bin/sourcekitten ["doc", "--"] (RuntimeError)

Running xcodebuild

Could not successfully run `xcodebuild`.

Please check the build arguments.

Saved `xcodebuild` log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log

Failed to generate documentation

为什么从 xcode 构建我的项目没有问题时运行失败

【问题讨论】:

【参考方案1】:

您可以查看内容

log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log

获取详细信息的错误

【讨论】:

【参考方案2】:

Jazzy 需要从命令行构建来生成文档。所以你需要一个类似的命令:

jazzy --build-tool-arguments -workspace,ios.xcworkspace,-scheme,iosapp

来自https://github.com/realm/jazzy

...尝试向 xcodebuild 传递额外的参数,例如 jazzy --build-tool-arguments -scheme,MyScheme,-target,MyTarget


如何找到要从 Jazzy 传递到 xcodebuild 的方案和目标

请务必cd 到您的 Xcode 工作区或 Xcode 项目所在的目录: cd path/to/ios.xcworkspace

xcodebuild -version

# online help
man xcodebuild

# List schemes & targets
xcodebuild -list

示例 Xcode 工作区的结果,

Information about project "ios":
    Targets:
        iosapp
        bench
        dynamic
        static
        bundle
        test
        integration
        Integration Test Harness

    Build Configurations:
        Debug
        Release
        RelWithDebInfo

    If no build configuration is specified and -scheme is not passed then "RelWithDebInfo" is used.

    Schemes:
        bench
        bundle
        CI
        dynamic
        dynamic+static
        Integration Test Harness
        iosapp
        static

【讨论】:

以上是关于Swift:Jazzy 无法运行 xcodebuild的主要内容,如果未能解决你的问题,请参考以下文章

IOS技术分享| iOS快速生成开发文档

IOS技术分享| iOS快速生成开发文档

找不到离子目标设备

无法为 iOS Swift 运行 Google Calendar API 示例代码

Swift Playground 无法在 iPad 上运行

Xcode 更新后 Swift Playgrounds 无法正常运行