I'm having trouble running a Cocoa app on 10.7 even though it seems like I'm taking the correct steps. Here's a description of what I'm doing and what seems to be wrong:
I'm building on a 10.8 machine with XCode 5.0.2 and SDK 10.9 with a deployment target of 10.7. One of my dynamic libraries uses some CoreGraphics functions, so I linked that library against ApplicationServices.framework. (From what I understand, prior to 10.8, CoreGraphics was included within ApplicationServices, so I can't link against CoreGraphics directly or I'll have problems.)
After building, my library that uses CoreGraphics has references directly to CoreGraphics.framework at /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics, but that path doesn't exist on 10.7. When I run the application on 10.8+, it works fine, but on 10.7, it blows up trying to load that framework that doesn't exist.
My (hacky) Solution:
After banging my head against this for a while, I decided to go nuclear and add a new Build Phase to change the CoreGraphics reference in my library to a path that is compatible with 10.7, beneath ApplicationServices.framework. My script does the following:
install_name_tool -change /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics myLibrary.dylib
This works, but it seems like a silly hack. Has anyone else seen this?
You have to test it, but maybe it is enough to just link against ApplicationServices.framework.
Otherwise you should be able to get it working with weak linking: In the Link Binary with Libraries Build Phase, change the Status from Required to Optimal. More details about weak linking can be found here.
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