Firebase 访问嵌入在静态pod中的XIB

Firebase 访问嵌入在静态pod中的XIB,firebase,cocoapods,Firebase,Cocoapods,我用的是Cocoapods1.8.4 我想对现有pod进行更新,我不是将其依赖性从4.10更新到6.10的原始作者。 为了能够构建,我必须在使用上一个firebase版本时将我的pod设置为statis library s.static_framework=true 现在,当我尝试实例化viewController(xib是pod的一部分)时,示例崩溃: *** Terminating app due to uncaught exception 'NSInternalInconsistencyE

我用的是Cocoapods1.8.4

我想对现有pod进行更新,我不是将其依赖性从4.10更新到6.10的原始作者。 为了能够构建,我必须在使用上一个firebase版本时将我的pod设置为statis library s.static_framework=true

现在,当我尝试实例化viewController(xib是pod的一部分)时,示例崩溃:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/Imotep/Library/Developer/CoreSimulator/Devices/B165BF4E-D41E-40BE-84C3-5DC5317DB3DE/data/Containers/Bundle/Application/BFE3CA2C-5244-42B3-9237-EB6CBBE133F5/MyPod_Example.app> (loaded)' with name 'MyPodViewController'
我试图通过将以下内容添加到我的podspec中,将XIB放入.bundle中: s、 resource_bundle={'MyPod'=>['MyPod/Classes/UI/*.{xib}']}


知道在我的示例应用程序的主包中,我正确地拥有一个包含笔尖的MyPod.bundle。但我似乎无法访问那些捆绑的笔尖>是的,您需要将它们捆绑在一起

输入:

在您的播客文件中:

只需检查您是否也没有s.resources条目,因为它会弄乱包路径

在您的swift课程中:

guard let bundleURL=Bundle.main.urlforResource:bundleResources,带扩展名:Bundle-else{ 回来 } guard let bundle=Bundleurl:Bundleurl else{ 回来 } 让vc:UIViewController=uiviewcontrollernbname:TestViewController,bundle:bundle self.presentvc,动画:true,完成:nil 输出:


它可以在吊舱内部或外部调用。

很好!它确实有效。我甚至没有尝试获取Bundle url并初始化一个Bundle,因为Bundle.allBundles没有列出我的Bundle,所以我猜获取它的url是不可行的。文档有点模糊,但似乎pod资源Bundle只有在从url显式加载后才显示在Bundle.allBundles中
s.static_framework = true
s.resource_bundles = {
  'bundleResources' => ['staticPod/Assets/*.png', 'staticPod/Assets/*.xib']
}