iosswiftxcodecocoapodspodspec

Private CocoaPod - module not found even though pod installed


I've created a new framework CocoaPod, here's a copy of my 'podspec' file:

Pod::Spec.new do |s|

# 1
s.platform = :ios
s.ios.deployment_target = '12.0'
s.name = "IdFramework"
s.summary = "IdFramework is a framework containing functionality."
s.requires_arc = true

# 2
s.version = "0.1.0"

# 3
s.license = { :type => "MIT", :file => "LICENSE" }

# 4 - Replace with your name and e-mail address
s.author = { "Idan Israel" => "myEmail" }

# 5 - Replace this URL with your own GitHub page's URL (from the address bar)
s.homepage = "link"

# 6 - Replace this URL with your own Git URL from "Quick Setup"
s.source = { :git => "{link to my framework on Github}",
             :tag => "#{s.version}" }

# 7
s.framework = "UIKit"
s.dependency 'Firebase'

# 8
"IdFramework/**/*"

# 9

# 10
s.swift_version = "4.2"

end

'podspec' uploaded successfully, I can see the sources on GitHub.

I've created a new project, in which I'm trying to use my newly created CocoaPod. Here's what the Podfile look like:

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

source 'https://github.com/CocoaPods/Specs.git'
source '{Link to my source code on GitHub}'

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

  # Pods for TestingPods
  pod 'IdFramework', '~> 0.1.0'

end

Here's the code I have inside the framework:

import Foundation
import Firebase

public class FirebaseConfig {
    public static func setupFirebase() {
        let arguments = ProcessInfo.processInfo.arguments as [String]
        var plistFileName = "GoogleService-Info-"

        if let environment = arguments.first?.split(separator: " ").last {
            plistFileName += environment
            
            guard let plistPath = Bundle.main.path(forResource: plistFileName, ofType: "plist"), let options =  FirebaseOptions(contentsOfFile: plistPath) else {
                return
            }
            
            if FirebaseApp.app() == nil{
                FirebaseApp.configure(options: options)
            }
        }
    }
}

The CocoaPod and all its dependencies are installed correctly, I can also see IdFramework under Pods in Xcode - however, when I try to import IdFramework - I'm getting a No such module 'IdFramework' error message.

I tried the following:

  1. pod deintegrate then pod install.
  2. Checking the Pods under Manage Schemes, and building both projects.
  3. Made sure that both iOS version and Swift version all match.
  4. Cleaned my project entirely and rebuild.

None of the above worked for me, and the issue persists. What can be the problem?


Solution

  • Replace #8 with:

    s.source_files  = "IdFramework/**/*"