DesperateLearner
DesperateLearner

Reputation: 1175

Module not found - cocoapods

I'm trying to pod install this library into my project's (lets say child xcodeproj) parent project (lets say Parent xcodeproj).

Child .xcodeproj has its own podfile where I have added RxSwift, RxCocoa, Realm and this GeoSwift library. Here is the cocoapods file as show below

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0"
inhibit_all_warnings!
use_frameworks!

project 'LocationManager/LocationManager'

def pods 

    pod 'GEOSwift'
    pod 'RxSwift', '~> 4.0'
    pod 'RxCocoa', '~> 4.0'
    pod 'RealmSwift', '~> 3.0'
end

target 'LocationManager' do

    pods

    target 'LocationManagerTests' do

        inherit! :search_paths

        pod 'RxBlocking', '~> 4.0'
        pod 'RxTest', '~> 4.0'
    end
end

This LocationManager is installed into another XCode project as another podfile

def location_pods
   pod 'GEOSwift'


   pod 'LocationManager', :git => '[email protected]:myrepo/locationmanager.git', :branch => 'users/me/add-geoswift'

end

target 'TestApp' do

   location_pods

   project 'TestApp.project'
end

When I try to compile the TestApp target, XCode throws an error as below enter image description here GeoSwift module is not found. This error is inside the Pods > LocationManager > MockLocationManager.swift The same module imported else where in that Pods > LocationManager works. Also import RxSwift and import RxCoca works. When I accessed Pods > Targets > LocationManager > Build Phases > Target Dependencies I see all the pods except GeoSwift enter image description here

May I know how to fix this issue? Adding GeoSwift to this targetDependency doesn't compile either. When compiling LocationManager.xcworkspace as a separate entity it works perfectly fine. That module import GeoSwift doesn't throw any compilation error.

Upvotes: 3

Views: 8701

Answers (2)

aryland
aryland

Reputation: 133

I had an issue similar to this.

Go into Pods:

Image of the Pods button

Then click on "Build Settings", find the row titled "Swift Language Version", and try updating it to the latest (in my case, it was 4.1).

How to update your Swift version

This worked for me! Hopefully it helps someone else out there too.

More info: Xcode 9 Swift Language Version (SWIFT_VERSION)

Upvotes: 2

RPM
RPM

Reputation: 3436

From what I know Cocoapods do not support sub-projects. I had an issue with this too and I promoted all my sub-projects as folders within the main project and put them under a different target. Now those targets can use Cocoapods too.

Upvotes: 0

Related Questions