Xcode 9归档Framework时内部生成别名问题求助(脚本归档场景)
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
YESfor 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 Copyoption is unchecked - For dynamic frameworks: Ensure
Code Sign On Copyis checked
- For static frameworks: Make sure the
- Also, confirm you haven’t added the frameworks to a
Copy Filesphase 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 Targetsetting 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

