简体   繁体   English

如何在 Fastlane 中指定 Xcode 版本?

[英]How to specify Xcode version in Fastlane?

Now I am specify the Xcode version in Fastlane file like this:现在我在 Fastlane 文件中指定 Xcode 版本,如下所示:

lane :beta do
    xcversion(version: "12.3")
    xcode_select "/Applications/Xcode_12.3.app"
    xcode-select -s /Applications/Xcode_12.3.app
    if is_ci
      create_keychain(
        name: ENV['MATCH_KEYCHAIN_NAME'],
        password: ENV["MATCH_KEYCHAIN_PASSWORD"],
        default_keychain: true,
        unlock: true,
        timeout: 3600,
        lock_when_sleeps: false
      )
    end
end

but it shows this error:但它显示了这个错误:

Run cd ./ios && bundle exec fastlane beta
+-----------------------+---------+--------+
|               Used plugins               |
+-----------------------+---------+--------+
| Plugin                | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.2   | pgyer  |
+-----------------------+---------+--------+

[02:14:34]: Sending anonymous analytics information
[02:14:34]: Learn more at https://docs.fastlane.tools/#metrics
[02:14:34]: No personal or sensitive data is sent.
[02:14:34]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[02:14:34]:     12:   lane :beta do
[02:14:34]:     13:     xcversion(version: "12.3")
[02:14:34]:  => 14:     xcode-select -s /Applications/Xcode_12.3.app
[02:14:34]:     15:     if is_ci
[02:14:34]:     16:       create_keychain(

[!] Syntax error in your Fastfile on line 14: Fastfile:14: syntax error, unexpected unary-, expecting `do' or '{' or '('
    xcode-select -s /Applications/Xcode_12.3.app
                 ^
Fastfile:14: unknown regexp options - Xcd
...e-select -s /Applications/Xcode_12.3.app
...                         ^~~~~~
Fastfile:14: syntax error, unexpected local variable or method, expecting `end'
...elect -s /Applications/Xcode_12.3.app
...                            ^~~
Fastfile:14: unexpected fraction part after numeric literal
...ect -s /Applications/Xcode_12.3.app
...                             ^~
Fastfile:46: syntax error, unexpected `end', expecting end-of-input
Error: Process completed with exit code 1.

What should I do to specify the version of Xcode?如何指定 Xcode 的版本?

The following is enough:以下内容就足够了:

xcversion(version: "12.3")

According to the Documentation :根据文档

Finds and selects a version of an installed Xcode (...)查找并选择已安装 Xcode 的版本(...)

So the xcode-select instruction is not needed.所以不需要xcode-select指令。 Regarding xcode_select , not sure if it even exists.关于xcode_select ,不确定它是否存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM