【发布时间】:2014-12-31 18:22:38
【问题描述】:
我做了什么
我已经构建了一个自定义的 iOS 框架,我们将称之为 CustomFramework.framework 以及一个用于一些名为 CustomFramework.bundle 的 sqlite 文件的随附资源包。我已将我的框架和资源包添加到另一个项目中,并且构建成功。
我要做什么
我正在尝试使用 CoreFoundation 访问资源包。然后我想选择一个特定的 sqlite 文件并打开它。
出了什么问题
我的框架内有一个名为ResourceHelper.cpp的文件。这是我要打开 sqlite 文件的地方。我正在尝试获取对 CustomFramework.bundle 包的引用。为此,我有这行:
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.mycompany.CustomFramework"));
在我的 CustomFramework-Info.plist 中,Bundle identifer 字段是 com.mycompany.CustomFramework。这行代码返回NULL;在调试器中它看起来像mainBundle = (CFBundleRef) 0x0。
为什么我找不到我的框架资源包?
谢谢
【问题讨论】:
标签: ios frameworks bundle core-foundation