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

归档iOS应用时出现链接器错误,模拟器与真机运行正常

Fixing "ld: framework not found Pods_NameofAPP" Error When Archiving

Hey there, let's work through this annoying linking error you're facing—totally frustrating when your app runs fine on simulators and physical iPhones but bombs out during archiving, right? Here are some targeted troubleshooting steps to try:

1. Refresh Your CocoaPods Setup

First, let's rule out corrupted Pod configurations, which are a common culprit here:

  • Close Xcode completely.
  • Delete the Pods folder, Podfile.lock, and .xcworkspace file from your project directory.
  • Run pod deintegrate in your terminal to fully remove Pods integration from your project.
  • Finally, run pod install to rebuild the Pods setup from scratch. This often fixes hidden mismatches between Debug and Release configurations.

2. Verify Build Settings for Release Mode

Since archiving uses the Release configuration, double-check these settings:

  • Framework Search Paths: Go to your project's Build Settings, search for this option. For the Release configuration, make sure it includes $(inherited) and ${PODS_ROOT}/Pods_NameofAPP (replace NameofAPP with your actual app name), and set the path type to recursive. The $(inherited) flag is critical—it pulls in all the paths CocoaPods defines.
  • Other Linker Flags: Ensure the Release configuration has $(inherited) listed here. Without this, Xcode won't pick up the linker directives from your Pods.
  • Build Active Architecture Only: For Release mode, set this to NO. If it's YES, Xcode might skip building the correct architecture for archiving, leading to missing frameworks.

3. Check Build Phases

CocoaPods usually adds critical build phases automatically—let's confirm they're present:

  • Open your project's Build Phases tab. Look for Copy Pods Resources and Embed Pods Frameworks phases. If either is missing, re-running pod install should restore them.
  • In Link Binary With Libraries, even if you can't find Pods_SharkMate directly, make sure all your Pods' frameworks are listed here. If any are missing, you can add them manually by clicking the + button and navigating to Pods/Products to select the relevant frameworks.

4. Clean Up Xcode Cache

Stale cache can cause weird inconsistencies:

  • Run Cmd+Shift+K to clean your project, then Cmd+Option+Shift+K to delete the entire Build folder.
  • Quit Xcode, then delete the DerivedData folder at ~/Library/Developer/Xcode/DerivedData (you can find this quickly via Xcode's Preferences > Locations tab).
  • Reopen your .xcworkspace file (not the .xcodeproj) and try archiving again.

5. Validate Your Archive Scheme

Make sure your scheme is configured correctly for archiving:

  • Go to Product > Scheme > Edit Scheme.
  • Select the Archive action in the left sidebar.
  • Under the Info tab, confirm that the "Build configuration" is set to Release (not a custom or Debug variant).

If none of these steps work, try manually adding the missing framework: Navigate to Pods/Products in your project, find Pods_NameofAPP.framework, drag it into the Link Binary With Libraries phase, and ensure it's also added to Embed Frameworks (if it's a dynamic framework).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 08:07:24