plists 的可加载包
我有一个主项目和主项目内的静态库项目。我想在我的静态库项目中添加一些 plist。由于没有资源目录,所以无法直接添加plist,所做的是这样的。
1.向我的静态库项目添加了可加载包 2.向可加载包中添加了一些plist 3.这个可加载包是作为我的静态库项目的依赖项而制作的 4.添加了这个可加载包作为我的主项目的依赖项,
我走的路正确吗?当我触发构建并使用 show content 来查看应用程序的内容时,我能够在 .app 文件中看到 .bundle 文件。现在我想知道如何访问这个捆绑包。 。
我用这个
NSBundle *staticlink = [NSBundle mainBundle] pathForResource:@"MyBundle" ofType:@"bundle"];
[staticlink load];
NSLog(@"%@",staticlink);
控制台说了这个。 。
. . . /mainproject.app/MyBundle.bundle <not yet loaded>
缺什么 ?我应该做什么加载 MyBundle ?
I have a main project and a static library project inside the main project. I want few plists in my static library project. Since there is no resource directory it is not possible to add plists directly, What is did is this.
1.Added a loadable bundle to my static library project
2.Added few plists to loadable bundle
3.This loadable bundle is made as a dependency to my static library project
4.Added this loadable bundle as a dependency to my main project as well
Am i going on the right path ? when i fired the build and used show contents to see the contents of the app i was able to see the .bundle file inside the .app file. Right now i want to know how to access this bundle . .
i used this
NSBundle *staticlink = [NSBundle mainBundle] pathForResource:@"MyBundle" ofType:@"bundle"];
[staticlink load];
NSLog(@"%@",staticlink);
console said this . .
. . . /mainproject.app/MyBundle.bundle <not yet loaded>
What is missing ? what should i do load MyBundle ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
-pathFoResource:ofType:
返回一个 NSString 对象,该对象将包含包的路径。-pathFoResource:ofType:
returns a NSString object which will have the path to the bundle.