问题
I've created a simple mac app that uses the Cocoa wrapper for libspotify.
When I export the project as an Application and try to run it, it crashes immediately.
Crash report:
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: @rpath/CocoaLibSpotify.framework/Versions/A/CocoaLibSpotify
Referenced from: /Users/USER/Desktop/Wunderkiste.app/Contents/MacOS/Wunderkiste
Reason: image not found
otool output:
$ otool -L ~/Desktop/Wunderkiste.app/Contents/MacOS/Wunderkiste
@rpath/CocoaLibSpotify.framework/Versions/A/CocoaLibSpotify (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1265.0.0)
/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData (compatibility version 1.0.0, current version 481.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.11.0)
Project - Build Phases
Any ideas?回答1:
The Runtime Search Paths
build setting in your project needs to contain @loader_path/../Frameworks
to tell the dynamic linker where to find CocoaLibSpotify at runtime.
See Linking and Install Names by Mike Ash for a detailed discussion.
来源:https://stackoverflow.com/questions/22265408/cocoalibspotify-library-not-loaded