vadymmarkov/Fakery

unable to find bundle named Fakery_Fakery

grutts opened this issue · 5 comments

Hi,

We have an Xcode project using Fakery (via Swift Package Manager). We define factories using Fakery in the app, and these are used in the unit tests. Now, we wanted to add these factories using Fakery to the UI test target.

We've linked the Fakery binary to the UI tests (Build Phases -> Link Binary with Libraries), but when we try to run the tests we get this error

Fatal error: unable to find bundle named Fakery_Fakery in resource_bundle_accessor.swift

I'm conscious this could be a setup issue on our end, but we can't figure it out. Could this be a bug or a limitation in how the library can be used?

Thanks in advance.

Fakery 5.1.0
Xcode 13.4.1

Did you ever find a solution to this?

I'm a Xcode newb, and I have the same issue. I figure it has to do with dependencies but haven't been able to figure out what's wrong.

I'm having this issue too. Code in resource_bundle_accessor.swift is explicitly looking for a bundle named "Fakery_Fakery", but it's not clear to me why (or where) that bundle should exist.

It turns out this is a general problem with Swift Package Manager and nested frameworks. The resoure_bundle_accessor.swift file is auto-generated by SPM, and it doesn't handle nested frameworks correctly.

I finally found a workaround for this: in the Xcode scheme editor, set the environment variable PACKAGE_RESOURCE_BUNDLE_PATH to $(CONFIGURATION_BUILD_DIR). In older version of Xcode it's PACKAGE_RESOURCE_BUNDLE_URL.