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

Xcode归档项目时遇ld链接错误求助:找不到-lReachability库

Fixes for "ld: library not found for -lReachability" in Xcode

Hey there, I’ve run into this exact linker error with Reachability before—super frustrating, but there are a few common fixes that usually sort it out. Let’s go through them step by step:

  • Double-check the Reachability library exists in your project
    Sometimes the file reference gets broken, or the library was accidentally deleted. Head to your project navigator and look for the Reachability files (typically Reachability.h/Reachability.m for Objective-C, or the Swift equivalent). If they’re missing, re-add them to your project—make sure to check "Copy items if needed" and select your target when prompted.

  • Confirm the library is linked to your target

    1. Select your project in the navigator, then pick your target under "Targets".
    2. Switch to the Build Phases tab.
    3. Expand Link Binary With Libraries—look for libReachability.a or the framework version. If it’s missing, click the + button, find the library in the list (or add it manually if it’s a custom build), and add it.
    4. Also check Compile Sources to ensure Reachability.m (if using Objective-C) is listed—add it here if it’s missing.
  • Fix your Library Search Paths
    The linker might not know where to locate the Reachability library:

    1. Go to your target’s Build Settings tab.
    2. Search for Library Search Paths.
    3. Add the path to the folder containing libReachability.a—use a relative path like $(PROJECT_DIR)/YourSubfolder (drag the folder into the field to auto-fill the correct path) instead of absolute paths (which break on other machines).
  • Clean your project and rebuild
    Cached build files often cause odd linker issues:

    • Press Cmd + Shift + K to clean the build folder.
    • Hold Option and go to Product > Clean Build Folder for a deeper clean.
    • Quit Xcode completely, reopen it, and try archiving again.
  • Check CocoaPods setup (if applicable)
    If you installed Reachability via CocoaPods, make sure you’re opening the .xcworkspace file (not .xcodeproj). Run pod install again to ensure all pods are properly integrated into your project.

  • Verify architecture compatibility
    Rarely, architecture mismatches can trigger this error. Go to Build Settings > Architectures and confirm the Reachability library was built for the same architectures as your target (usually Standard Architectures (arm64, x86_64) for modern projects).

If none of these work, try creating a new test project, add Reachability to it, and attempt to archive—this will help you narrow down if the issue is with your project’s setup or the library itself.


内容的提问来源于stack exchange,提问作者vesselin ivanov

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 04:05:18