28

I have forked a framework called BTNavigationDropdownMenu (swift project for ios). all worked fine till I tried to add a dependency to the latest version in the branch I created. the problem is the same whether I add the other framework (DYBadge) through a podfile or through Carthage.

Auto-Linking framework not found DYBadge.

It seems to have a problem with a UIView extension that is part of DYBadge.

DYBadge works fine in my main app I'm working on (I also need it in the app target).

errors below. thanks for any hints into the right direction.

ld: warning: Auto-Linking framework not found DYBadge Undefined symbols for architecture x86_64: "(extension in DYBadge):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?", referenced from: Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Kaushik Makwana
  • 1,329
  • 2
  • 14
  • 24
domi852
  • 497
  • 1
  • 4
  • 13

11 Answers11

30

Xcode is not able to find your frameworks because the FRAMEWORK_SEARCH_PATHS is probably not set or is wrong (happened to me because I moved the Info.plist file).

You can fix this by going into your target and adapt the Build Settings. Simply search in there for FRAMEWORK_SEARCH_PATHS and add the correct one, which is usually $(PROJECT_DIR)/Carthage/Build/iOS (for iOS projects). $(inherited) should also be in there as the first entry.

This is the post of @user3122959 answer in the comments, which helped me and others to fix this problem and was requested to put in as the answer to this question.

palme
  • 2,499
  • 2
  • 21
  • 38
  • I had this problem with a Pod (SQLite in this case), and had to add: "${PODS_CONFIGURATION_BUILD_DIR}/SQLite.swift" – Jason Feb 24 '19 at 03:39
  • 1
    I had $(inherited) in my Framework Search Paths, but the fix for me was to set $(inherited) to be `recursive` instead of `non-recursive` – Andy Novak Apr 05 '21 at 17:32
9

Try this process -

  1. Press "Cmd + Shift + K" or shift + cmd + alt + k to clean up, and quit Xcode.
  2. Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
  3. Open the project and re-build it
Rashed
  • 2,349
  • 11
  • 26
  • 20
    thanks a lot. it didn't help but I found that for some reason the Framework search paths in the app target were missing, I re-added them and it worked. issued closed and sorry for the trouble. //:configuration = Debug FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/Carthage/Build/iOS //:configuration = Release FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/Carthage/Build/iOS //:completeSettings = some FRAMEWORK_SEARCH_PATHS – domi852 Apr 11 '18 at 09:09
  • 12
    @user3122959 you can write this like an answer – Alexander Khitev Aug 02 '18 at 17:03
  • 2
    Thanks user3122959 for the answer and @Alexander Khitev for the request to make it into a post. I tried to do that just now. – palme Feb 12 '19 at 13:28
7

I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.

  1. In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries

  2. In Finder goto: Carthage > Build > yourframework.Framework

  3. Drag the framework in to your build phases then clean (cmd - shift - K).

Declan McKenna
  • 4,321
  • 6
  • 54
  • 72
3

This can also be an error if you use a framework that has Bitcode Enabled on false. Bitcode Enabled can only be true if all frameworks also have Bitcode enabled true. Go to your targets build settings and disable bitcode.

Secondwave
  • 225
  • 1
  • 4
  • 17
2

For me this fixed it:

Go to Project > Targets > Build Settings (Tab) > Build Options (Heading)

Set Enable Testing Search Paths to Yes.

Instantly back up and running. Honestly not sure what this means but it worked.

ElliotD
  • 1,279
  • 2
  • 10
  • 9
0

If you are using Carthage and several Projects within one Workspace you have to add a symlink to your Main Carthage Folder. it will depend what structure you have, but for example if you have

Project -> Carthage

Project -> Frameworks -> MyImbaFramework than cd in terminal in MyImbaFramework folder and run

ln -s ../../Carthage Carthage

swift2geek
  • 1,697
  • 1
  • 20
  • 27
0

In my case, there was an issue with Bitcode, but Xcode couldn't give an accurate error diagnostic since the project framework references were also somehow messed up. Running the framework tests worked fine, but archiving gave the auto-linking error.

Deleted all framework references from the project, including the Frameworks group they were under, added them back again resolved the references issue, then I got the bitcode issue, which I disabled on the target framework, then and only then, archiving was successful

Mazyod
  • 22,319
  • 10
  • 92
  • 157
0

I had a similar error and none of the suggestions on this page worked. It occurred when trying to create an archive when pointing to my test iPhone, when I changed it to 'Any iOS Device' it worked correctly. I suspect this is related to the recent change to add support for Apple Silicon but I'm not certain how.

Leon
  • 3,614
  • 1
  • 33
  • 46
0

Make sure you haven't set a testfile that imports XCTest's TargetMembership to the main target, but to a test target :-)

Nicolai Harbo
  • 1,064
  • 12
  • 25
0

Hope this helps someone, this is what worked for me

rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf Pods
rm Podfile.lock
pod cache clean --all
pod install --repo-update

and cleaning the build folder

XCode > Product > Clean Build Folder

or

⌘ Command + ⇧ Shift + K

then closing XCode an clearing the derived data again

rm -rf ~/Library/Developer/Xcode/DerivedData
Asleepace
  • 3,466
  • 2
  • 23
  • 36
0

For me, the problem was that I had set the "Other Linker Flags" setting prior to converting my project to use Cocoapods. To fix this, I changed that field to use $(inhereted) and everything worked after that.

enter image description here

Anthony Dito
  • 3,610
  • 3
  • 29
  • 56