我正在使用xcconfig文件在调试和发布模式下定义键。这是我的podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'MainTarget' do
use_frameworks!
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
end
target 'Target2' do
use_frameworks!
pod 'Alamofire','~>4.4'
end
target 'Target3' do
use_frameworks!
pod 'Alamofire','~>4.4'
end
target 'NetworkLibrary' do
use_frameworks!
pod 'Alamofire','~>4.4'
end
Target2,Target3,网络库是添加到项目中的框架。 以下是我的dubug.xcconfig:
#include "Pods/Target Support Files/Pods-MainTarget/Pods-MainTarget.debug.xcconfig"
#include "Pods/Target Support Files/Pods-NetworkLibrary/Pods-NetworkLibrary.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Target1/Pods-Target1.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Target2/Pods-Target.debug.xcconfig"
MAIN_KEY = 3145bjk34
FULL_KEY = 23bjkkj31
我以类似的方式定义了release.xcconfig(只是更改键值和pod包含)。 我收到错误FMDB.h文件未找到。为什么我会得到这个?在添加配置之前一切正常。我也在Info选项卡中添加了配置文件。
有趣的是,如果我改变我的podfile,就像下面一样,它工作正常:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'MainTarget' do
use_frameworks!
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
end
target 'Target1' do
use_frameworks!
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
end
target 'Target2' do
use_frameworks!
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
end
target 'NetworkLibrary' do
use_frameworks!
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
end
如果我将所有pod添加到框架中它工作正常。为什么会发生这种情况?
答案 0 :(得分:0)
尝试继承搜索路径。这是您可以尝试的Podfile版本。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'MainTarget' do
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
target 'Target2' do
inherit! :search_paths
end
target 'Target3' do
inherit! :search_paths
end
target 'NetworkLibrary' do
inherit! :search_paths
end
end
如果这不起作用,abstract_target
可以解决问题
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
abstract_target 'Defaults' do
pod 'Alamofire','~>4.4'
pod 'KFSwiftImageLoader'
pod 'FMDB'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts'
pod 'OpenSSL-Universal'
pod 'EVReflection'
pod 'Socket.IO-Client-Swift'
pod 'GoogleMaps'
target 'MainTarget' do
end
target 'Target2' do
end
target 'Target3' do
end
target 'NetworkLibrary' do
end
end