Main app cannot find a pod used by custom shared framework

39 Views Asked by At

I have a main app "authenticator" that uses a custom framework "storage". The "storage" use RealmSwift to handle any CRUD functionality and being used by the main app and its embedded extensions. This is the Podfile:

# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

workspace 'authenticator-ios'

target 'authenticator-ios' do
  project 'authenticator-ios'
  # Pods for authenticator-ios
  pod 'Rudder', '~> 1.15.1'
  pod 'RxSwift', '6.6.0'
  pod 'RxCocoa', '6.6.0'
  pod 'KeychainAccess'
  pod 'Swinject'
  pod 'SwiftOTP', :git => 'https://github.com/lachlanbell/SwiftOTP.git', :branch => 'swift-5.0-cryptoswift'
  pod 'RecaptchaEnterprise', '18.3.0'
  pod 'RealmSwift', '~>10'
  pod 'Alamofire'
  pod 'RxAlamofire'
  pod 'SwiftLint'
  pod 'lottie-ios'
  
  target 'authenticator-iosTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'RxBlocking', '6.6.0'
    pod 'RxTest', '6.6.0'
  end

  target 'authenticator-iosUITests' do
    inherit! :search_paths
    # Pods for testing
    pod 'RxBlocking', '6.6.0'
    pod 'RxTest', '6.6.0'
  end
end

target 'storage' do
  project 'storage'
  pod 'RealmSwift', '~>10'
  target 'storageTests' do
  end
end


# FORCE SET DEPLOYMENT TARGET TO 11.0 SINCE platform :ios, '11.0' DIDN'T DO ANYTHING!
post_install do |pi|
    pi.pods_project.targets.each do |t|
        t.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
        end
    end
end

I have done pod install. I have added the storage.framework into the Frameworks, Libraries, and Embedded Content in General tab and Link Binary With Libraries in Build Phases tab. When I switch the scheme to storage, I can build the framework. But when I switch back and try to build the main app it returned this error:

No such module 'RealmSwift'

And the corresponding line is not a line from the main app's classes, but the storage framework's. It is in all of the derivations of RealmSwift.Object that are only used internally in the framework. The main app shouldn't (and doesn't) know about these classes.

Case in point: Error

Can anybody tell me what's wrong? Thank you.

0

There are 0 best solutions below