简体   繁体   中英

How to specify Xcode version in Fastlane?

Now I am specify the Xcode version in Fastlane file like this:

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?

The following is enough:

xcversion(version: "12.3")

According to the Documentation :

Finds and selects a version of an installed Xcode (...)

So the xcode-select instruction is not needed. Regarding xcode_select , not sure if it even exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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