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
Podfileto 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
.xcworkspacefile after runningpod install—never the.xcodeprojfile, as it won't include CocoaPods dependencies.
Step 2: Check Xcode Build Settings
- Navigate to your target's Build Settings:
- Find
Framework Search Pathsand confirm it includes$(inherited)—this ensures CocoaPods' auto-configured paths are used. - Check
Runpath Search Paths; it must contain these values (order doesn't matter):@executable_path/Frameworks@loader_path/Frameworks$(inherited)
The@rpathin the error relies on these paths to locate embedded frameworks at runtime.
- Find
Step 3: Validate Build Phases Configuration
- Go to your target's Build Phases:
- In
Link Binary With Libraries, confirmGTMSessionFetcher.frameworkis present and set toRequired(orOptionalif your code handles missing frameworks, though this is rare). - Most importantly, check
Embed Frameworks—this is where the crash often happens. EnsureGTMSessionFetcher.frameworkis listed here, and theCode Sign On Copycheckbox is ticked. Dynamic frameworks need to be embedded to be available at runtime.
- In
Step 4: Clean & Rebuild Your Project
- Clear cached build data to eliminate stale configurations:
- Use
Product > Clean Build Folder(shortcut:Shift + Cmd + K) in Xcode. - Delete your Derived Data: Go to
Xcode > Preferences > Locations, click the arrow next to Derived Data, and delete the folder for your project.
- Use
- 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.lockto 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 withpod updateto 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 Frameworksare being signed properly (theCode Sign On Copysetting 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
相关产品推荐
相关产品推荐

