ios - “导入桥接头失败”iOS 单元测试
问题描述
我有一个带有 2 个开发目标和 1 个单元测试目标的 iOS 项目。开发目标是混合的(同时使用 Objective-c 和 Swift),因此我必须Bridging-Header.h
在项目中使用。
问题是当我想使用以下代码将模块导入我的单元测试类时:
@testable import <Module>
通过添加上述行,单元测试将停止构建并输出以下错误:
/Users/admin/Projects/<Project>/Tests/<TestClass>.swift:10:18: Failed to import bridging header '/Users/admin/Projects/<Project>/Core_Services_Interfaces/<Module>-Bridging-Header.h'
导入的 Objective-c pod 似乎存在一些问题。解决问题的任何帮助表示赞赏。
PS:我的Podfile
:
target '<TARGET_1>' do
platform :ios, '8.0'
inhibit_all_warnings!
pod 'GoogleAnalytics'
pod 'GoogleIDFASupport'
pod 'GoogleAPIClient/Calendar', '~> 1.0.2'
pod 'GTMOAuth2', '~> 1.1.0'
pod 'GoogleMaps'
pod 'MARKRangeSlider'
pod 'MGSwipeTableCell'
pod 'KVNProgress'
pod 'Adjust', '~> 4.11.0'
pod 'HCSStarRatingView', '~> 1.5'
pod 'SDWebImage', '~>3.8'
pod 'MMPopupView'
pod "MXPagerView"
pod 'AppAnalytics'
pod 'MXSegmentedPager'
pod 'MBProgressHUD', '~> 1.1.0'
pod 'PKHUD', '~> 4.0'
pod 'DeviceGuru'
use_frameworks!
pod 'Alamofire', '~> 4.7'
pod 'ObjectMapper', '~> 3.3.0'
pod 'RealmSwift'
pod 'netfox'
pod 'KeychainSwift', '~> 11.0'
pod 'NVActivityIndicatorView'
pod "PullToRefreshKit" , "~> 0.6.0"
pod 'MaterialShowcase'
pod 'Segmentio', '~> 3.2'
target '<TARGET_2>' do
inherit! :complete
end
target '<TEST_TARGET>' do
inherit! :complete
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.include?('MaterialShowcase')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
end
end
解决方案
推荐阅读
- macos - 如果我更改我的 OSX 应用程序上的 BundleID,我将看不到存储在 CoreData 中的当前记录
- android - TextView 没有出现在模拟器和真实设备上
- excel - 如何在 VBA 代码中将名称范围用于新图表系列的值和 X 值?
- git - 添加第二个远程删除的文件
- django-templates - 编写测试时 Circle CI 的 Django 模板错误
- omnet++ - omnet ++ 程序,执行此消息时,模块中出现错误(cModule)
- pkcs#11 - PKCS11 将私有 RSA 密钥解包到 eToken HSM
- angular - 是否可以在角度 2 中读取其他应用程序的本地存储?
- laravel - 使用 Mix/Webpack 将 quill.js 导入 Laravel
- svn - 需要帮助使用 Cake 对 SVN 存储库进行身份验证