简体   繁体   English

Xcode 10 测试目标构建错误

[英]Xcode 10 Tests target build errors

No matter what I do, I get some error or the other in MyApp-SwiftTests target.无论我做什么,我都会在 MyApp-SwiftTests 目标中遇到一些错误或其他错误。 This is happening on upgrading to XCode 10/Swift 4.2.这是在升级到 XCode 10/Swift 4.2 时发生的。 The error I got initially was "Failed importing Module with name MyApp-Swift", and on reading various answers on SO, I changed Product Module Name and Product Name to $(TARGET_NAME).我最初得到的错误是“导入名为 MyApp-Swift 的模块失败”,在阅读有关 SO 的各种答案时,我将产品模块名称和产品名称更改为 $(TARGET_NAME)。 But now the error is:但现在错误是:

  <unknown>:0: error: module name "MyApp-SwiftTests" is not a valid identifier
  Command CompileSwiftSources failed with a nonzero exit code

How do we avoid build errors in Tests target?我们如何避免测试目标中的构建错误?

As you mention, in "MyApp-SwiftTests", dash is not allowed.正如您所提到的,在“MyApp-SwiftTests”中,不允许使用破折号。 Use "MyApp_SwiftTests" will solve your problem.使用“MyApp_SwiftTests”将解决您的问题。

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

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