【发布时间】:2018-06-19 10:24:39
【问题描述】:
GIVEN:我正在实现一个框架,该框架需要首先搜索应用程序包中的所有 JSON 文件;如果什么都没有,那么我从我的框架内加载 JSON 文件
我已经尝试使用UIApplication.self 作为参数的Bundle api,如bundleForClass:,但仍然访问我自己的框架包。有人可以建议一种方法来满足我的需求吗?
【问题讨论】:
-
好的,我解决了...只需使用
Bundle.main,您就可以访问应用程序包。在此之前,我只是想在框架中时,它指的是框架包,因为苹果文档说:For a running app, the main bundle offers access to the app’s bundle directory. For code running in a framework, the main bundle offers access to the framework’s bundle directory.谁能解释在框架中运行的代码到底是什么?它不是我编写并打包为动态框架的吗?