【问题标题】:run xcode ui test from command line in xcode 8 using swift 2.3使用 swift 2.3 从 xcode 8 中的命令行运行 xcode ui 测试
【发布时间】:2016-10-04 13:06:30
【问题描述】:

我使用这个命令从终端运行我的 xcode build ui 测试:

xcodebuild -workspace test.xcworkspace \
-scheme "test" \
-destination 'platform=iOS Simulator,name=ipad Air' \
test

但最近我从 xcode 7.3 迁移到 xcode 8

我使用来自

的 swift 2.3
use swift legacy version 

来自构建设置选项。

但是当我使用该命令时它显示错误并且它不运行 ui 测试。

它工作正常,如果我不使用命令行运行测试,我的意思是直接从项目中运行,它运行 xcode ui 测试并且终端命令适用于 xcode 7.3 非常好

错误是

error: filename "file.swift" used twice:
 filenames are used to distinguish private declarations with the same name

请帮助我如何解决问题。

【问题讨论】:

    标签: xcode macos osx-elcapitan xcode8 xcode-ui-testing


    【解决方案1】:

    xcodebuild 在 swift 3 上原生编译

    但是你可以添加一个参数,让你在 swift 2.3 上编译。
    我正在使用

    xcodebuild -toolchain com.apple.dt.toolchain.Swift_2_3 ...other-parameters
    

    而且效果很好。

    最后,请注意,总有一天你应该通过 swift 3!

    【讨论】:

    • 到现在同样的错误显示......它可以构建但如果我使用“测试”,它不能成功,错误是一样的......看到有问题的错误
    • 啊...肯定还有第二个问题。无论如何,您应该告诉 xcodebuild 要编译哪个版本的 swift。您的“测试”目标似乎有问题。根据错误信息,“file.swift”被使用了两次。尝试在您的项目管理器中搜索“file.swift”,看看是否有重复。如果没有,请尝试删除“file.swift”并重新导入。
    猜你喜欢
    • 2011-07-21
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-16
    • 2018-08-02
    • 2014-11-11
    相关资源
    最近更新 更多