lundi 8 février 2016

iOS Unit Tests Failed To Import Bridging Header

I have a mixed objective-c and swift project that is using cocoapods for dependency management. What i'm trying to accomplish is getting unit testing to work by just utilizing the new @testable import workflow.

The problem is that when i attempt to do this, i get a "Failed to import bridging header" message. When looking at the actual errors, it appears that i'm getting a duplicate interface definition for a pod that i'm using. I've tried using both the current 0.39.0 release of cocoapods and the new 1.0 release. Below is my current 1.0 pod file setup.

source 'http://ift.tt/1czpBWo'
inhibit_all_warnings!
platform :ios, '8.0'

target 'BuilderTREND' do
    pod 'MMDrawerController', '~> 0.5.6'
    pod 'MZFormSheetController', '~> 2.3.6'
    pod 'CXAlertView', '~> 1.0.1'
    pod 'NJKWebViewProgress', '~> 0.2.3'
    pod 'MZTimerLabel', '~> 0.4.1'
    pod 'AFNetworking', '~> 2.5.3'
    pod 'CocoaAsyncSocket', '~> 7.3.5'
    pod 'NSLogger'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'DTCoreText'
    pod 'NHAlignmentFlowLayout'

    target 'BTPhotoSharing' do

    end

    target 'BTDocumentProvider' do

    end

    target 'BTDocumentProviderFileProvider' do

    end

    target 'BuilderTRENDUnitTests' do
        inherit! :search_paths
    end

end


post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        end
        puts "=== #{target.name}"
    end
end

The main target builds perfectly fine, but i get the errors below when trying to run the unit tests. Defines module is set to yes, testability is set to yes and i've followed the cocoapods guide by using the inherit! :search_paths flag on the unit tests.

It is saying that importing the header of the pod is conflicting with the actual definition of the pod?

enter image description here

Aucun commentaire:

Enregistrer un commentaire