You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加自定义DehancerNavigation.framework后出现框架未找到错误

I'm learning framework development, and have completed these steps:

  • Created a standalone Cocoa Framework project
  • Migrated code and successfully compiled to generate DehancerNavigation.framework
  • Added this framework to a new blank test project's Embedded Binaries (under the General tab), and it also appeared in the Linked Frameworks and Libraries list automatically

However, when compiling the test project, I get this linker error:

Ld /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject normal x86_64
cd /Users/yefim/Documents/Projects/DehancerNavigationTestUsageProject
export MACOSX_DEPLOYMENT_TARGET=10.13
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -F/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -filelist /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.LinkFileList -Xlinker -rpath -Xlinker @executable_path/../Frameworks -mmacosx-version-min=10.13 -Xlinker -object_path_lto -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.swiftmodule -framework DehancerNavigation -Xlinker -dependency_info -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_dependency_info.dat -o /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject

ld: framework not found DehancerNavigation
clang: error: linker command failed with exit code 1 (use -v to see invocation).

What additional configurations do I need to make to use this framework successfully?


Let’s walk through the most common fixes for this linker issue:

1. Verify Framework Path & Update Framework Search Paths

Xcode can’t find your framework because it’s looking in the wrong directory. Here’s how to fix it:

  • First, move the DehancerNavigation.framework to a stable location relative to your test project (like a dedicated Frameworks folder inside your test project’s directory). Avoid leaving it in the framework project’s build folder—this path changes when you clean builds.
  • Open your test project’s Build Settings, search for Framework Search Paths. Add the path to the folder containing your framework using a relative path like $(PROJECT_DIR)/Frameworks (adjust if you placed it elsewhere). Check the recursive box if needed.

2. Confirm Framework Architecture Matches Your Test Project

Your test project is compiling for x86_64 (as seen in the error log), so your framework must support this architecture. To check:

  • Open Terminal, navigate to the folder with DehancerNavigation.framework, then run:
    lipo -info DehancerNavigation.framework/DehancerNavigation
    
  • If x86_64 isn’t listed, go back to your framework project’s Build Settings:
    • Set Architectures to Standard Architectures (x86_64, arm64) (or just x86_64 if you only need Intel Mac support)
    • Set Build Active Architecture Only to No for the Debug configuration (so it builds all required architectures)
  • Recompile the framework and re-add it to your test project.

3. Double-Check Embedding Configuration

Even if the framework shows up in Linked Frameworks, improper embedding can cause path issues:

  • Go to your test project’s Build Phases tab.
  • Look for the Embed Frameworks phase. Make sure DehancerNavigation.framework is listed here, with the Embed setting set to Embed & Sign.
  • If it’s missing, drag the framework from the Project Navigator into the Embed Frameworks phase—this will automatically update Linked Frameworks too.

4. Clean Xcode Cache

Corrupted derived data often causes weird linker glitches. Let’s clear it:

  • Go to Xcode > Preferences > Locations, click the arrow next to the Derived Data path to open the folder. Delete the folder for your test project (DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp).
  • Back in Xcode, press Cmd + Shift + K to clean the build folder.
  • Rebuild your test project.

After trying these steps, your linker error should be resolved. If you’re still stuck, double-check that you didn’t rename the framework after compiling—Xcode relies on exact naming for linking.


内容的提问来源于stack exchange,提问作者Efim Plotnikov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:31:21