在动态Swift框架中导入Firebase(带/不带Cocoapods)并将框架导入到app目标中

cau*_*lux 15 xcode ios cocoapods firebase swift

Firebase for iOS是一个Objective-C框架,它建议使用Cocoapods进行集成.这是我试图设置它的方式:

我在OS X 10.11.6上运行Xcode 8b6.该应用程序是使用iOS 10 SDK构建的,目标是iOS 9.

MyApp 是我想要使用的常规(Swift)iOS应用程序.

MyFramework是一个嵌入式动态框架与app,q.我希望将所有Firebase代码抽象到框架中,然后将Firebase添加到MyFramework我的目标中Podfile:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'MyApp' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp
  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

target 'MyApp' do
  pod 'Firebase'
  pod 'Firebase/Database'
  pod 'Firebase/Auth'
end
Run Code Online (Sandbox Code Playgroud)

在运行时pod install,我可以在所有.swift文件中导入Firebase MyFramework.但是,import MyFramework在我的应用程序中的任何地方使用时,我都会收到错误Missing required module Firebase.

考虑到这可能是一个Cocoapods问题,我开始了一个新项目并手动集成Firebase,但最终遇到了同样的问题.这是一个已知的问题?如果是的话,有什么修复方法吗?

小智 -1

也许你可以将其包含在你的 podfile 中

\n\n

//因为你的目标是iOS 9.0

\n\n
platform :ios, '9.0'\nuse_frameworks!\n\ndef firebase_pods\n pod 'Firebase'\n pod 'Firebase/Database'\n pod 'Firebase/Auth'\nend\n\ntarget 'MyApp\xe2\x80\x99 do\n firebase_pods\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果这对您不起作用,请告诉我,我可以尝试以其他方式提供帮助

\n