Reputation: 527
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)
Upvotes: 31
Views: 81820
Reputation: 21
You can fix this by adding your framework to Build Phases -> Link Binary With Libraries
I faced the same problem with the GoogleMobileAds framework but I resolved it with the above solution
Upvotes: 0
Reputation: 1395
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.
Upvotes: 2
Reputation: 3670
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.
Upvotes: 0
Reputation: 3745
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
Upvotes: 1
Reputation: 1169
Make sure you haven't set a testfile that imports XCTest's TargetMembership to the main target, but to a test target :-)
Upvotes: 0
Reputation: 3726
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.
Upvotes: 0
Reputation: 4870
I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.
In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries
In Finder goto: Carthage > Build > yourframework.Framework
Drag the framework in to your build phases then clean (cmd - shift - K).
Upvotes: 8
Reputation: 245
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.
Upvotes: 3
Reputation: 22559
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
Upvotes: 0
Reputation: 1812
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
Upvotes: 0
Reputation: 2609
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.
Upvotes: 30
Reputation: 2425
Try this process -
"Cmd + Shift + K"
or shift + cmd + alt + k
to clean up, and quit Xcode."rm -rf ~/Library/Developer/Xcode/DerivedData"
in terminalre-build
itUpvotes: 9