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

Xcode 9归档Framework时内部生成别名问题求助(脚本归档场景)

Fixing Alias/Shortcut Issues in Custom Frameworks During Archive

Hey there, I’ve run into this exact problem multiple times while working on projects with multiple custom frameworks, so let’s break down the most reliable solutions that have helped me and other developers resolve this:

1. Set Skip Install to YES for All Embedded Frameworks

This is the most common culprit. When you archive your main target, Xcode tries to install non-embedded frameworks to a system-level directory—and your app bundle ends up with an alias pointing to that location instead of the actual framework binary.

  • Go to each custom framework’s Build Settings
  • Search for Skip Install
  • Ensure the setting is set to YES for both Debug and Release configurations (since archives use Release by default)

2. Verify the Embed Frameworks Phase Configuration

Double-check how your frameworks are embedded in the main target:

  • Open your main target’s Build Phases tab
  • Navigate to Embed Frameworks
    • For static frameworks: Make sure the Code Sign On Copy option is unchecked
    • For dynamic frameworks: Ensure Code Sign On Copy is checked
  • Also, confirm you haven’t added the frameworks to a Copy Files phase accidentally—this can cause duplicate entries and alias issues.

3. Audit Your Archive Script Parameters

If you’re using a custom xcodebuild script, make sure you’re passing the correct parameters to avoid unexpected behavior:

  • Always specify the Release configuration explicitly:
    xcodebuild archive -scheme YourMainScheme -configuration Release -archivePath ./YourAppArchive.xcarchive
    
  • Avoid mixing debug flags or incomplete destination settings—this can throw off Xcode’s archiving logic.

4. Clear Derived Data and Rebuild

Stale cached build files often lead to weird archive glitches. Clean up and start fresh:

  • Run this command in Terminal to delete all Derived Data:
    rm -rf ~/Library/Developer/Xcode/DerivedData
    
  • Then re-run your archive script from scratch.

5. Ensure Consistent Deployment Targets

Mismatched deployment targets between your main target and frameworks can trigger Xcode’s compatibility workarounds, which sometimes result in aliases:

  • Check the Deployment Target setting in Build Settings for every framework and your main target
  • Make sure they all match (e.g., iOS 16.0 for all targets)

If you’ve tried all these steps and still see the alias issue, feel free to share more details like:

  • Whether your frameworks are static or dynamic
  • The exact content of your archive script
  • Any custom build phases you’ve added to your targets

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 07:13:39