We have a working Mac OS X screensaver as a standalone Xcode project, but we needed to have it as a target in another Xcode project that also contains a related app.
I added a target for a screensaver, copied the code, added to that target, etc, etc. The code is the same one that works in the other screensaver, but on this one, it generates the following error:
2015-03-10 09:43:24.766 System Preferences[32495]: Error loading /Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja: dlopen(/Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja, 265): Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja
Reason: image not found
2015-03-10 09:43:24.766 System Preferences[32495]: ScreenSaverModules: can't get principalClass for /Users/pupeno/Library/Screen Savers/Ninja.saver
The library in question is definitely there:
$ ls -w1 Library/Screen\ Savers/Ninja.saver/Contents/Frameworks/
libswiftAppKit.dylib
libswiftCore.dylib
libswiftCoreGraphics.dylib
libswiftDarwin.dylib
libswiftDispatch.dylib
libswiftFoundation.dylib
libswiftObjectiveC.dylib
libswiftQuartzCore.dylib
libswiftSecurity.dylib
Any ideas what might be causing this?
The problem was that the Runpath Search Path, for some reason, in this new target, was blank. I fixed this problem by adding this:
@executable_path/../Frameworks @loader_path/../Frameworks
to it (which I took from the working screensaver configuration). This is how it looks like:
Like Pablo said, you need the following as your Runtime Search Path:
@executable_path/../Frameworks @loader_path/../Frameworks
This should be the default. Make sure it's there though. You also need to set Embedded Content Contains Swift Code to YES if you're using Swift. That took me awhile to figure out.
(Xcode should totally infer this. Oh well. I filed a radar for this awhile.)
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