Search code examples
xcodecocoaframeworksfuse

Including OSXFUSE framework in XCode project


I have build a App based on OS X FUSE (ie I have my own file system based on OS X FUSE). When OSXFUSE is installed I can of course include the OSXFUSE.framework from /Library/Frameworks. However when I distribute the App I cannot expect the user to already have it installed, so I tried to include the framework with the bundle as follows:

  • dragged the framework from /Library/Frameworks to my project
  • created a new Copy Files build phase (with target Frameworks)
  • added the framework to that copy build phase

However when I run that on a system without FUSE installed I get an error:

dyld: Library not loaded: /Library/Frameworks/OSXFUSE.framework/Versions/A/OSXFUSE Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/

Shouldn't the copy build phase prevent this? What am I missing here?


Solution

  • I finally found out that I can tell XCode explicitly to weakly link a framework by changing the required flag to optional.

    This can be done in Project Overview > Target > Linked Frameworks and Libraries. Next to each framework is a dropdown-menu where you can select optional.

    Change link status for framework

    So my question is actually a duplicate of this How do I weak link frameworks on Xcode 4?