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

Xcode 9.2下CocoaPods已安装但无法正常工作的问题求助

Troubleshooting CocoaPods Not Working in Xcode 9.2

Hey there, let's work through this frustrating CocoaPods issue you're hitting in Xcode 9.2. I've run into similar odd behavior before, so let's go through targeted fixes that should resolve the framework path confusion and get your pods working properly.

Step 1: Wipe Clean Existing CocoaPods Residues

Sometimes leftover files or cached data are the root cause. Let's start fresh:

  • Delete these items from your project directory: Podfile.lock, the Pods folder, and your .xcworkspace file.
  • Run the deintegrate command to fully remove CocoaPods traces:
    pod deintegrate
    
    (If you don't have this command installed, run gem install cocoapods-deintegrate first.)
  • Clear Xcode's derived data to eliminate cached build artifacts:
    rm -rf ~/Library/Developer/Xcode/DerivedData
    
  • Restart Xcode—don't skip this! Xcode holds onto cached settings stubbornly, and a restart can clear weird glitches.

Step 2: Verify Podfile & Deployment Target Alignment

Mismatched deployment targets often cause framework path issues:

  • Open your Podfile and ensure the platform line matches your main project's Deployment Target. For Xcode 9.2, this is typically something like:
    platform :ios, '11.0'
    
  • Double-check that your main project's Deployment Target (in Project > Build Settings > Deployment Target) matches the one in your Podfile.

Step 3: Fix Framework Search Paths

Instead of just setting recursive mode, let's ensure the paths are correctly inherited:

  • Open your main project's Build Settings, find Framework Search Paths.
  • Delete any custom absolute paths you've added.
  • Add $(inherited) as the top entry—this tells Xcode to use the paths automatically injected by CocoaPods, avoiding manual conflicts.
  • Make sure the path is set to recursive (you mentioned you did this, but confirming it's paired with $(inherited) is key).

Step 4: Check Pods Project Configuration

Occasionally, individual pod targets have misconfigured settings:

  • Open your .xcworkspace file (not the .xcodeproj—this is critical!)
  • Select the Pods project in the navigator, then check each pod's Build Settings:
    • Ensure their Deployment Target matches your main project's target.
    • Verify their Framework Search Paths also include $(inherited).

Step 5: Reinstall Pods with a Compatible Version

Xcode 9.2 works best with specific CocoaPods versions (newer versions may introduce compatibility issues):

  • First, update your local pod repo to pull the latest compatible pod versions:
    pod repo update
    
  • If your current CocoaPods version is too new or old, install a version known to work with Xcode 9.2:
    gem install cocoapods -v 1.5.3
    
  • Finally, run pod install and open the .xcworkspace file again.

If you still see duplicate files in the framework directory after these steps, try checking for duplicate pod entries in your Podfile—sometimes accidental duplicates can cause this kind of clutter.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 04:09:36