vadymmarkov / Fakery

:alien: Swift fake data generator
https://vadymmarkov.github.io
Other
1.79k stars 182 forks source link

unable to find bundle named Fakery_Fakery #153

Open grutts opened 1 year ago

grutts commented 1 year ago

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

jdelaune commented 1 year ago

Did you ever find a solution to this?

kepstein commented 1 year ago

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.

Uncommon commented 1 year ago

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 commented 1 year ago

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 commented 8 months ago

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.