Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency ModuleMap generation error (.modulemap' not found / underlying Objective-C module not found) #267

Open
mariusjcb opened this issue Feb 13, 2021 · 2 comments

Comments

@mariusjcb
Copy link

mariusjcb commented Feb 13, 2021

Context:

I need to import multiple versions of a specific framework (Lottie; lottie-ios) in my iOS app. For instance I'm trying to do a workaround by creating a cocoapod library for each version just to expose some wrappers over the dependency framework (Lottie). I tested it in a Example project and it works fine. I am able to run the project and it imports dependency framework (lottie-ios) but also my wrapper library (LOTTIE_3.2.1) correctly.

Problem:

To avoid framework hell I would like to find a way to "embed" each version of lottie-ios framework in my cocoapods wrapper libraries (e.g. my pod LOTTIE_3.2.1 will embed lottie-ios version 3.2.1). For this I tried cocoapods-packager but it refuses to compile. (tried with both Xcode 11.7 and Xcode 12)

ERROR:

<unknown>:0: error: module map file '/var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/build/Release-iphoneos/lottie-ios/Lottie.modulemap' not found
    <unknown>:0: error: module map file '/var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/build/Release-iphoneos/lottie-ios/Lottie.modulemap' not found
    <unknown>:0: error: underlying Objective-C module 'LOTTIE_3_2_1' not found
    /var/folders/0s/5l55p26n0xv0gcnvdsk2qnsw0000gn/T/cocoapods-y48kqyis/Pods/LOTTIE_3.2.1/LOTTIE_3.2.1/Classes/LottieVersionable.swift:1:8: error: cannot load underlying module for 'Lottie'
    import Lottie
           ^

Environment:

  1. Ruby 2.6.0
  2. Cocoapods-Packager 1.5.0 (master, not the tag/release)
  3. Cocoapods 1.10.1
  4. Xcode 12 & 11.7

Podspec:

Pod::Spec.new do |s|
  s.name             = 'LOTTIE_3.2.1'
  s.version          = '0.1.0'
  s.summary          = 'A short description of LOTTIE_3.2.1.'

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC
  s.swift_version    = '5.2'
  s.homepage         = 'https://google.com'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'Marius Ilie' => '[email protected]' }
  s.source           = { :git => '~/LOTTIE_3.2.1/.git', :tag => s.version.to_s }

  s.swift_version = '5.0'
  s.ios.deployment_target = '9.0'
  s.osx.deployment_target = '10.10'
  s.tvos.deployment_target = '9.0'

  s.ios.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
  s.tvos.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
  s.osx.frameworks = ['AppKit', 'CoreGraphics', 'QuartzCore']

  s.source_files = 'LOTTIE_3.2.1/Classes/**/*'
  s.dependency 'lottie-ios', '3.2.1'
  
  s.pod_target_xcconfig = {
    'OTHER_SWIFT_FLAGS' => '-DLOTTIE_3',
  }
end

LottieVersionable.swift Class:

import Lottie

fileprivate protocol LOTAnimationViewVersionable {
    func setAnimationData(_ data: Data)
}

#if LOTTIE_3
public typealias LOTAnimationView = AnimationView
#endif

extension LOTAnimationView: LOTAnimationViewVersionable {
    #if LOTTIE_3
    func setAnimationData(_ data: Data) {
        self.animation = try? JSONDecoder().decode(Animation.self, from: data)
    }
    #elseif LOTTIE_2
    func setAnimationData(_ data: Data) {
        // todo
    }
    #else
    func setAnimationData(_ data: Data) {
        fatalError("WRONG LOTTIE VERSION")
    }
    #endif
}

Command: bundle exec pod package LOTTIE_3.2.1.podspec

Command Output: terminal-output.log

@mariusjcb mariusjcb changed the title Embedded Frameworks in Swift/iOS: Cocoapods-Packager dependency ModuleMap generation error: Embedded Frameworks in Swift/iOS: Cocoapods-Packager dependency ModuleMap generation error Feb 13, 2021
@mariusjcb mariusjcb changed the title Embedded Frameworks in Swift/iOS: Cocoapods-Packager dependency ModuleMap generation error Dependency ModuleMap generation error (.modulemap' not found / underlying Objective-C module not found) Feb 13, 2021
@TyrantDante
Copy link

try https://github.com/TyrantDante/cocoapods-framework.git

@RMKitty
Copy link

RMKitty commented Aug 13, 2021

I have the same error . Have you solution to the problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants