3

I have an iOS project with 2 development targets and 1 unit test target. The development targets are hybrid (using Objective-c and Swift at the same time), thus I have to use Bridging-Header.h within the project.

The problem is when I want to import the module into my unit test class using the following code:

@testable import <Module>

By adding the above line, unit tests stop building and output the following error:

/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'

It seems it has some kinds of problems with imported Objective-c pods. Any help in resolving the problem is appreciated.

P.S: My 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
Hassan Shahbazi
  • 1,543
  • 9
  • 26

0 Answers0