私は、ココアポッドバージョン1.1.1、スイフト3.0.1およびXcode 8.1を使用しています。私は、ブリッジング・HEADER.Hファイルを使用する理由それはだ、私はココアポッド:Swiftコンパイラエラー "Bridging Headerをインポートできませんでした"の理由?
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
platform :ios, '8.0'
use_frameworks!
target 'TestApp' do
pod 'GoogleAnalytics', '~> 3.14.0'
end
target 'TestAppTests' do
pod 'Quick'
pod 'Nimble'
end
この(Podfile)のように、カカオポッドを使用するアプリを、持っていると私はまた、いくつかのObjective-Cのファイルを持っています。
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#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"
私がTestAppを実行すると、完全に実行されます。しかし、ユニットテストケースを実行すると、TestAppTests - > Swiftコンパイラエラー - >#import "GoogleAnalytics/GAI.h"の "TestApp-Bridging-Header.h"というヘッダをインポートできませんでした。
私は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
私はスウィフト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?
してください理由を説明してください。
私は以前にそれがうまく働いて、2つの目標で同じポッドを置くのはなぜ。 –
ポッドを使って追加したくない場合は、Xcodeからそのターゲットを追加することができます。 –