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

iOS App运行崩溃:dyld加载GTMSessionFetcher.framework失败(CocoaPods场景)

Fixing dyld: Library not loaded: @rpath/GTMSessionFetcher.framework/GTMSessionFetcher in CocoaPods

Hey there, let's work through this common CocoaPods runtime crash together. This error usually boils down to misconfigured build settings or incomplete framework embedding, so here are the steps to diagnose and fix it:

Step 1: Verify CocoaPods Setup & Reinstall Dependencies

  • First, double-check your Podfile to ensure GTMSessionFetcher (or the framework that depends on it, like Firebase libraries) is listed correctly.
  • Close Xcode entirely, then run these commands in your project directory to refresh your pods:
    pod deintegrate
    pod install
    
  • Critical Note: Always open your project using the .xcworkspace file after running pod install—never the .xcodeproj file, as it won't include CocoaPods dependencies.

Step 2: Check Xcode Build Settings

  • Navigate to your target's Build Settings:
    1. Find Framework Search Paths and confirm it includes $(inherited)—this ensures CocoaPods' auto-configured paths are used.
    2. Check Runpath Search Paths; it must contain these values (order doesn't matter):
      • @executable_path/Frameworks
      • @loader_path/Frameworks
      • $(inherited)
        The @rpath in the error relies on these paths to locate embedded frameworks at runtime.

Step 3: Validate Build Phases Configuration

  • Go to your target's Build Phases:
    1. In Link Binary With Libraries, confirm GTMSessionFetcher.framework is present and set to Required (or Optional if your code handles missing frameworks, though this is rare).
    2. Most importantly, check Embed Frameworks—this is where the crash often happens. Ensure GTMSessionFetcher.framework is listed here, and the Code Sign On Copy checkbox is ticked. Dynamic frameworks need to be embedded to be available at runtime.

Step 4: Clean & Rebuild Your Project

  • Clear cached build data to eliminate stale configurations:
    1. Use Product > Clean Build Folder (shortcut: Shift + Cmd + K) in Xcode.
    2. Delete your Derived Data: Go to Xcode > Preferences > Locations, click the arrow next to Derived Data, and delete the folder for your project.
  • Restart Xcode, then rebuild and run your project.

Step 5: Check Dependency Version Compatibility

  • If GTMSessionFetcher is a transitive dependency (e.g., pulled in by Firebase), open Podfile.lock to verify its version. Ensure it's compatible with the parent framework—sometimes outdated or mismatched versions can break dependency resolution. You can try updating your pods with pod update to get compatible versions.

Step 6: Test Across Devices/Simulators

  • If the crash only happens on a real device (or only the simulator), check your target's Signing & Capabilities:
    • Confirm your team and signing certificate are correctly set.
    • Ensure all embedded frameworks in Embed Frameworks are being signed properly (the Code Sign On Copy setting helps with this).

Hopefully one of these steps resolves the issue for you. If you're still stuck, feel free to share more details like which frameworks you're using or any recent changes to your project setup!

内容的提问来源于stack exchange,提问作者ajeet sharma

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 07:32:38