0

I am using xcconfig files for defining keys in debug and release mode. This is my 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,Network Library are frameworks added to project. Following is my 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

I defined release.xcconfig in a similar way(just changing key values and pod includes). I am getting error FMDB.h file not found. Why might i get this? Before adding configs everything was working fine. I added my config files in the Info tab too.

Interestingly if i change my podfile like following it is working fine:

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

If i add all pods to frameworks it is working fine.Why is this happening?

Gabriel Diez
  • 1,648
  • 2
  • 17
  • 26
Bharath Reddy
  • 636
  • 1
  • 5
  • 21

1 Answers1

0

Try inheriting the search paths instead. Here is a version of your Podfile you could try.

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

If that doesn't work, an abstract_target may do the trick

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
Hodson
  • 3,438
  • 1
  • 23
  • 51
  • With this I am getting error while building saying "Alamofire cannot be loaded in underlying module" in Target 1 and Target 2. I could solve the issue by adding all the pods to frameworks but my question is why is it happenning like that? Thank you for answering – Bharath Reddy Aug 07 '17 at 10:09
  • In all honesty, I don't fully understand your issue. If for some reason, your other targets do require the pods then you can try using an `abstract_target` as in my updated answer. – Hodson Aug 07 '17 at 10:24