I am using cocoa pod version 1.1.1, swift 3.0.1 and Xcode 8.1. I have an application that uses cocoa pod like this (Podfile)
platform :ios, '8.0'
use_frameworks!
target 'TestApp' do
pod 'GoogleAnalytics', '~> 3.14.0'
end
target 'TestAppTests' do
pod 'Quick'
pod 'Nimble'
end
And I also have an objective-C file, so I used the Bridging-Header.h file.
#import <CommonCrypto/CommonCrypto.h>
#import <GoogleAnalytics/GAI.h>
#import <GoogleAnalytics/GAIFields.h>
#import <GoogleAnalytics/GAIDictionaryBuilder.h>
#import <GoogleAnalytics/GAILogger.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "AModel+Level.h"
#import "AModel+AutoStatus.h"
#import "AModel+Settings.h"
#import "APacketData+Decoders.h"
#import "Reachability.h"
When I run TestApp, it works fine. But I run unit test cases, I got an error in TestAppTests → Swift compiler error → Failed to import the header title “TestApp-Bridging-Header.h” into #import “GoogleAnalytics / GAI.h” not found.
I fix this problem using this technique in podfile:
platform :ios, '8.0'
use_frameworks!
target 'TestApp' do
pod 'GoogleAnalytics', '~> 3.14.0'
end
target 'TestAppTests' do
pod 'GoogleAnalytics', '~> 3.14.0'
pod 'Quick'
pod 'Nimble'
end
I just want to find out below the mention of points when I port the code in Swift 3.0.1:
1. Is it require to install every pods in different targets? or we have any alternate solution.
2. What is the best technique to handle this kind of problems?
Please explain the reasons.