ios - 无法在捆绑包中加载 NIB - pod 中有自己的框架
问题描述
我已经开发了一个框架并将其添加到 pod 中,以便开发人员可以使用 pod 安装它,就完成了。但是当开发人员尝试加载控制器时,他们会收到此错误
由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法在包中加载 NIB:“NSBundle(已加载)”,名称为“XViewController”
在 google/stackoverflow 上找到了一些帮助,但没有用 Bundle code 是
static var framework: Bundle? {
let currentBundle = Bundle.init(for: XViewController.self)
if let path = currentBundle.path(forResource: "Resources", ofType: "bundle") {
return Bundle(path: path)
}
return currentBundle
}
pod 仅包含一个.framework
文件
podspec 文件是
Pod::Spec.new do |s|
s.name = 'XXSDK'
s.version = '1.0.1'
s.summary = 'A tool to enforce Swift style and conventions.'
s.homepage = 'https://example.com/sdkportal/'
s.license = { :type => 'MIT' }
s.author = { 'XXX' => 'abc@gmail.com' }
s.source = { :http => 'fakeurl/XXSDKframework.zip' }
s.ios.deployment_target = '10.0'
s.ios.vendored_frameworks = 'XXSDK.framework'
s.dependency "RealmSwift"
s.dependency "Alamofire"
s.dependency "MBProgressHUD"
end
.framework
如果我仅通过插入文件来使用,一切正常XXSDK.framework
,但如果我使用 pod,则会导致上述问题。
提前致谢。
解决方案
推荐阅读
- php - 为什么当计数器等于三时它不重定向页面?
- angular - Angular 2 - Favicons Webpack 插件在许多文件中注入 html
- amazon-web-services - Amazon Athena 中的 HIVE_INVALID_METADATA
- google-apps-script - 在公式中输入中断
- corda - 在 cordapp api/flow 中通过唯一 ID 查找状态
- cygwin - 如何使用cygwin监控java进程
- qt - 如何使用 CMake 从 qmake 建模 OTHER_FILES?
- java - Java Hashset 基于值而不是哈希码存储项目
- python-3.x - 无法使用 selenium 和 python 找到引用的 ID
- ios - SegmentControl 在 UITableviewCell 上复制复选标记