When including Kingfisher using latest Carthage in a project which has subprojects as components, when running one of the subprojects tests we get the following error:
2018-04-17 14:14:03.494908+0200 xctest[8052:65955] The bundle âMyProjectUITestsâ couldnât be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2018-04-17 14:14:03.495059+0200 xctest[8052:65955] (dlopen_preflight(/Users/Me/Library/Developer/Xcode/DerivedData/MyProjectiOS-cmerazywlpjaaidjguatkfroiqih/Build/Products/Debug-iphonesimulator/MyProjectUITests.xctest/FitterYouUITests): Library not loaded: @rpath/libswiftAccelerate.dylib
Referenced from: /Users/Me/Code/Apple/MyProject/Carthage/Build/iOS/Kingfisher.framework/Kingfisher
Reason: image not found)
Program ended with exit code: 82
As you can see it seems there's an issue with the Accellerate framework which is included. I'm guessing that since the dependency isn't placed directly into the component project, Xcode has problems including the implicit dependency without explicitly stating where it is. The usual search paths (I know about @loader_path and @rpaths â already tried those approaches to fix this) seem not to be enough.
@Dschee Not sure what could cause it, but it is more likely an issue that the test bundle (target) does not contain libswiftAccelerate.dylib. Maybe it worth to try to enable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in the Info.plist of your UI test target too?
Already tried that, didn't work. Found a workaround: Using HanekeSwift now instead of Kingfisher. ;)
Great!
Sorry for being rude, shouldn't have made a joke about it, was disrespectful.
Thank you for taking the time to help me. đ
@Dschee No, don't worry guy. I was not angry at all. đ
Thanks for taking time on trying this project and opening the issue. I am sorry that I didn't help you out and I'd take a look at it when I have a chance later since it is weird to me.
Ah, ok, then I overknterpreted things. Anyways, was rude. ^^
By the way, the project structure where I integrated this os weird, too. If I were you Iâd keep in the back of my mind that there was such an issue bbt wonât do anything about it unless someone else would run into similar problems. But itâs weird in any case ...
Sure. Maybe you were importing or using Kingfisherâs method in the UI test target, which did not make sense and should not happen in fact. I would try to see whether I can reproduce it later, but if I cannot, I will just let it go.
Thanks!
Hello @onevcat.
I have the same issue.
The bundle âTestsâ couldnât be loaded because it is damaged or missing necessary resources.
Try reinstalling the bundle.
(dlopen_preflight(/Tests.xctest/Tests): Library not loaded: @rpath/libswiftAccelerate.dylib
Referenced from: /Kingfisher.framework/Kingfisher
Reason: image not found)
Any ideas on how to fix it?
Solved by importing accelerate in the header file of the networking framework (where kf is imported):
#import <Kingfisher/Kingfisher.h>
#import <Accelerate/Accelerate.h>
Try clean build folder
@GWesley clean build folder made it work for me, I don't think this is related to Kingfisher
Adding the imports didn't worked for me, neither cleaning build folder. Not even adding Accelerate.framework to the "Link Binary with Libraries" phase
Any other ideas?
I am also running into this issue. Changing @rpath settings for my project hasn't resulted in a compiled UI test either.
(dlopen_preflight(/Users/ryan.jones/Library/Developer/Xcode/DerivedData/*-dqxcewttakcreqdcoyalatljzzay/Build/Products/Debug-iphonesimulator/UITests-Runner.app/PlugIns/UITests.xctest/UITests): Library not loaded: @rpath/libswiftAccelerate.dylib
Referenced from: /Users/ryan.jones/Library/Developer/Xcode/DerivedData/-dqxcewttakcreqdcoyalatljzzay/Build/Products/Debug-iphonesimulator/UITests-Runner.app/PlugIns/*UITests.xctest/Frameworks/Kingfisher.framework/Kingfisher
One alternative is to fork Kingfisher and remove everything related to Accelerate. It's basically just removing the "blur" feature anyway, so I think it won't be an issue for most people
I fixed this with adding import Accelerate to some swift files in test scheme.
The same here. I've removed Kingfisher to AlamofireImage.
I think we have to create sub-spec for advanced filtering image effect. It will avoid specific linking of unused framework imports too.
The issue is still happening why was it closed? I get the same issue on my test target
Kingfisher relies on Accelerate framework to do fast blur processor. In an app target, Xcode could find these kinds of implicit dependencies automatically and link them when necessary. But in a test target, it seems that Xcode has some issues to find implicit dependencies, so you need to add the Accelerate.framework to the linked binary section in build setting yourself manually.
@gal-orlanczyk
You could add a new empty target (as single view application), add Accelerate framework (General - Linked Frameworks and Libraries) and define "Host Application" as just added target.
Inspired by:
https://stackoverflow.com/a/42424793
@onevcat Still not working by your solution. Build setting didn't have linked binary section.
Most helpful comment
Solved by importing accelerate in the header file of the networking framework (where kf is imported):