Fakery icon indicating copy to clipboard operation
Fakery copied to clipboard

unable to find bundle named Fakery_Fakery

Open grutts opened this issue 3 years ago • 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

grutts avatar Nov 29 '22 16:11 grutts

Did you ever find a solution to this?

jdelaune avatar Jan 19 '23 16:01 jdelaune

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.

kepstein avatar May 12 '23 03:05 kepstein

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.

Uncommon avatar Jul 25 '23 14:07 Uncommon

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.

Uncommon avatar Jul 25 '23 20:07 Uncommon

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.

Uncommon avatar Dec 07 '23 04:12 Uncommon