私人 CocoaPod - 即使安装了 pod 也找不到模块
Private CocoaPod - module not found even though pod installed
我创建了一个新框架 CocoaPod
,这是我的 'podspec' 文件的副本:
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'上传成功,我可以在GitHub
.
上看到源
我创建了一个新项目,我试图在其中使用我新创建的 CocoaPod
。这是 Podfile
的样子:
# 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
这是我在框架中的代码:
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)
}
}
}
}
CocoaPod
及其所有依赖项都已正确安装,我还可以在 Xcode
中的 Pods
下看到 IdFramework
- 但是,当我尝试导入 IdFramework
- 我收到 No such module 'IdFramework'
错误消息。
我尝试了以下方法:
pod deintegrate
然后 pod install
.
- 检查
Manage Schemes
下的 Pods
,并构建两个项目。
- 确保
iOS version
和 Swift version
都匹配。
- 完全清理了我的项目并重新构建。
None 以上对我有用,但问题仍然存在。可能是什么问题?
将 #8 替换为:
s.source_files = "IdFramework/**/*"
我创建了一个新框架 CocoaPod
,这是我的 'podspec' 文件的副本:
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'上传成功,我可以在GitHub
.
我创建了一个新项目,我试图在其中使用我新创建的 CocoaPod
。这是 Podfile
的样子:
# 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
这是我在框架中的代码:
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)
}
}
}
}
CocoaPod
及其所有依赖项都已正确安装,我还可以在 Xcode
中的 Pods
下看到 IdFramework
- 但是,当我尝试导入 IdFramework
- 我收到 No such module 'IdFramework'
错误消息。
我尝试了以下方法:
pod deintegrate
然后pod install
.- 检查
Manage Schemes
下的Pods
,并构建两个项目。 - 确保
iOS version
和Swift version
都匹配。 - 完全清理了我的项目并重新构建。
None 以上对我有用,但问题仍然存在。可能是什么问题?
将 #8 替换为:
s.source_files = "IdFramework/**/*"