When I use resources: [.copy("Resources")] for my Swift package, the bundle can't be built: "Command CodeSign failed with a nonzero exit code" (undle format unrecognized, invalid, or unsuitable).
When I rename the folder to something else, the package can be built without issues.
What's wrong with "Resources"?
In my experience, .copy may trigger code-signing operations depending on the platform. Alternatively, you can use .process instead of .copy like this:
resources: [
.process("Resources"),
]
If you use .process you also need to update the way how you obtain your resource files:
// .copy()
let json = Bundle.module.url(forResource: "Resources/user", withExtension: "json")!
// .process()
let user = Bundle.module.url(forResource: "user", withExtension: "json")!
From the Apple Developer Documentation:
If you apply the process rule to a directory’s path, Xcode applies the rule recursively to the directory’s contents. If no special processing is available for a resource, Xcode copies the resource to the resource bundle’s top-level directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With