CocoaPods常见Pod依赖问题:Parse与Facebook SDK的Bolts版本不匹配报错
Hey there, let's tackle that frustrating Bolts version conflict you're hitting when setting up Parse and Facebook SDKs with CocoaPods. I've run into this exact issue multiple times, so here's how to get things working smoothly:
Why This Happens
Both Parse SDK and Facebook SDK rely on the Bolts framework, but they often specify different compatible version ranges. When CocoaPods tries to resolve these dependencies, it can't find a version that satisfies both, leading to the mismatch error.
Step-by-Step Solutions
1. Manually Specify a Compatible Bolts Version
First, pick a Bolts version that works with both SDKs. For most recent Parse and Facebook SDK releases, Bolts 1.9.0 is a safe, widely compatible choice (you can double-check each SDK's docs if you want confirmation).
Add this line to your Podfile alongside your other pods:
pod 'Parse' pod 'FacebookCore' pod 'FacebookLogin' # Or other Facebook SDK components you need pod 'Bolts', '1.9.0' # Force this unified version across all dependencies
Then run this command in your terminal:
pod install --repo-update
2. Let CocoaPods Auto-Resolve a Compatible Version
If you're unsure which exact version to use, use a version range to let CocoaPods find the best match automatically. Modify your Podfile like this:
pod 'Parse' pod 'FacebookCore' pod 'FacebookLogin' pod 'Bolts', '~> 1.9' # Matches any version >=1.9.0 and <2.0.0
Again, run pod install --repo-update to let CocoaPods handle the rest.
3. Clean Up Cache if Issues Persist
Sometimes old cached dependencies can cause conflicts even after updating your Podfile. Run these commands to reset everything:
pod deintegrate # Remove all existing pods from your project pod clean # Clear cached pod files rm -rf Podfile.lock # Delete the lock file to force a fresh dependency resolve pod install --repo-update # Reinstall with updated dependencies
4. Diagnose the Exact Conflict (If Needed)
If you still see errors, you can check which version each SDK is requesting by running:
pod install --verbose
Look for lines mentioning Bolts to see the version ranges each SDK requires, then pick a version that fits both ranges perfectly.
内容的提问来源于stack exchange,提问作者Fabio Gomez

