Search code examples
iosxcodexcode7cocoapodscarthage

Can't link any framework using Carthage or CocoaPods


I've tried to add a few Icon-font projects to my Cocoa Touch Framework using both CocoaPods as well as Carthage, but keep getting ld: framework not found SomeIconFont

Things I've tried to do:

  • Dragged and dropped latest .framework into Linked Framework and Libraries
  • Have tried to add a Copy Files with destination Frameworks in Build Phases before Link Binary with Libraries phase
  • Have added the carthage copy-frameworks Run Script for the framework with $(SRCROOT)/Carthage/Build/iOS/SomeIconFont.framework
  • Have set Build Active Architecture Only to Yes at both, the Project level as well as the target
  • Architecture for both is Standard
  • Have set Framework Search Paths for both, Project as well as Target to $(SRCROOT)/Carthage/Build/iOS and $(PROJECT_DIR)/Carthage/Build/iOS respectively
  • Have tried Cleaning, resetting DerivedData

My last options are animal-sacrifice and an underwater hand-stand, but of course, they're only second to reinstalling Xcode and its few GB again. I'm only posting this question because quite honestly, completely beaten by this problem for the last 48 hours


Solution

  • At the end of 2 gruelling days (what I've saved you from!), I've finally managed to fix this:

    Underneath Framework Search Paths, you shall see Debug and Release, and both house a Any Architecture | Any SDK.

    Simply setting Any Architecture | Any SDK to $(inherited) fixed this issue for me. Of course, this will not work if you haven't set the top-level to $(SRCROOT)/... as shown in the OP, as it will only mimic the parent element's value!

    Why this is not a duplicate of one of the hundred other questions/blogs you'll find online: nearly all relevant posts as of writing this are for an Application, and not a Dynamic Library/Cocoa Touch Framework