为什么使用Bundle.Module时找不到Swift软件包的捆绑包?
我正在构建一个Swift软件包库,其中包含/swift-spk/sources/spk/resources/names.txt
的文本资源。该资源被复制到目标中:
.target(
name: "SPK",
dependencies: [],
resources: [
.copy("Resources/names.txt")
]),
... ... bundle.module
访问者被生成,我在Swift软件包中使用它在私有函数中(bundle.bundle.module call。 Swift软件包)。我在操场文件中运行代码,并且运行时失败了错误消息:
SPK/resource_bundle_accessor.swift:27: Fatal error: unable to find bundle named swift-spk_SPK
我正在遵循我在教程中找到的指南以及去年的类似问题,因此我很好奇资源加载是否有任何更改。
预先感谢您的任何支持
I'm building a Swift Package library that contains a text resource inside /swift-spk/Sources/SPK/Resources/names.txt
. The resource is being copied into the target as:
.target(
name: "SPK",
dependencies: [],
resources: [
.copy("Resources/names.txt")
]),
... The Bundle.module
accessor is generated and I use it in a private function within the Swift Package (the Bundle.module call is performed from within the Swift Package). I run the code within a Playground file and the runtime fails with an error message:
SPK/resource_bundle_accessor.swift:27: Fatal error: unable to find bundle named swift-spk_SPK
I'm following the guidelines I found on tutorials and similar questions from last year here so I'm curious if there have been any changes to the resource loading.
Thanks in advance for any support ????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论