iOS - 从发布版本中排除测试文件 [英] iOS - Exclude Test files from Release build
问题描述
在开发 iOS 应用程序时,我需要运行 unit &ui 在预加载的数据库上进行测试.因此,我计划将预加载在应用程序中的 DB 文件仅用于调试构建,因为 UI/单元测试将仅与调试构建一起运行.如何从发布版本中排除 DB 文件?
While developing an iOS application, I am required to run unit & ui tests on a preloaded database. So, I planned to include the DB file preloaded in the App only for DEBUG build as UI/Unit tests will run only with DEBUG build. How can i exclude the DB file from Release build?
目前我可以使用以下方式检测主机应用程序是否正在运行以进行测试,
Currently I can detect if the host app is running for testing or not using following way,
https://stackoverflow.com/a/33466038/1084174、
但是如何使用这种技术排除和包含 database.db?
but how can exclude and include database.db using this technique?
我们将不胜感激.
推荐答案
我终于解决了这个问题.
Finally i solve the problem.
打开您的项目文件.在屏幕底部点击 Add Build Setting -> Add User Defined Setting 并将其命名为 EXCLUDED_SOURCE_FILE_NAMES.
Open your project file. At the bottom of the screen click Add Build Setting -> Add User Defined Setting and name it EXCLUDED_SOURCE_FILE_NAMES.
单击 EXCLUDED_SOURCE_FILE_NAMES 左侧的箭头将其展开.在此变量的 Release 配置中,添加 libTestFlight.a 和您想要排除的任何其他文件(以空格分隔).
Click the arrow to the left of EXCLUDED_SOURCE_FILE_NAMES to expand it. In the Release configuration for this variable, add libTestFlight.a and any other files you’d like to exclude (separated by spaces).
这篇关于iOS - 从发布版本中排除测试文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!