I'm working on a large multi-platform iOS project (iOS, iPadOS, watchOS, tvOS, visionOS) and have successfully migrated from legacy .strings
files to modern String Catalogs (.xcstrings
). However, I'm unable to export localizations using xcodebuild -exportLocalizations
due to cross-platform framework dependency issues. (Note: I did have AI help me write this question, so apologies in advance for any errors)
Project Structure
- Main iOS/iPad app with multiple extensions
- watchOS companion app
- tvOS app
- visionOS app
- 49
.xcstrings
files successfully migrated across all targets - Uses Swift Package Manager for modularization
The Problem
When attempting to export localizations using xcodebuild -exportLocalizations
, the build fails because it tries to build all targets across all platforms, including watchOS targets that depend on third-party xcframeworks that don't include watchOS slices:
xcodebuild -exportLocalizations \
-project MyProject.xcodeproj \
-scheme MyApp \
-localizationPath ./export \
-configuration Debug
Error:
error: While building for watchOS, no library for this platform was found in
'Frameworks/<incompatible>.xcframework'. (in target 'Target')
These frameworks cannot be modified to add watchOS support (third-party/legacy dependencies).
What Works vs. What Doesn't
Works: Building the iOS app through Xcode GUI
Fails: Exporting localizations through Xcode GUI (Product → Export Localizations...)
Fails: xcodebuild -exportLocalizations
with any combination of flags
Attempted Solutions (All Failed)
- Platform-specific destination:
xcodebuild -exportLocalizations -destination "generic/platform=iOS" ...
- SDK constraint:
xcodebuild -exportLocalizations -sdk iphoneos ...
- Excluding architectures:
xcodebuild -exportLocalizations EXCLUDED_ARCHS="armv7k arm64_32" ...
- Build first, then export:
xcodebuild build -scheme MyApp -sdk iphoneos && \
xcodebuild -exportLocalizations ...
All approaches still attempt to build watchOS targets despite platform constraints.
Observations
- The
-exportLocalizations
flag appears to ignore-destination
and-sdk
flags - It seems to scan and build ALL schemes/targets in the project regardless of constraints
- Regular builds (
xcodebuild build
) work fine with platform constraints
Current Workaround
I created a Python script that parses .xcstrings
JSON files directly and generates XLIFF output, which works but feels like it's bypassing Apple's intended workflow.
Questions for Apple
-
Is there a way to limit
xcodebuild -exportLocalizations
to specific platforms? The documentation doesn't mention any flags for this, and-destination
/-sdk
appear to be ignored. -
Why does
-exportLocalizations
require building ALL targets across ALL platforms? Both the Xcode GUI (Product → Export Localizations) andxcodebuild -exportLocalizations
fail with identical build errors, suggesting this is by design. Is there a reason localization export can't be limited to buildable targets? -
Is the intended workflow to have ALL targets buildable across ALL platforms before exporting localizations? This seems impractical for multi-platform projects with platform-specific dependencies.
-
Are there any build settings or configuration options that can exclude specific targets/platforms from the localization export scan?
-
Is directly parsing
.xcstrings
files and generating XLIFF an acceptable alternative, or does this miss important metadata that-exportLocalizations
would include?
Environment
- Xcode 16.x / 26.x (reproduces on both)
- macOS Tahoe
- Project uses String Catalogs (.xcstrings) format
- Mixed SPM packages and traditional target structure
Any guidance on the correct approach for multi-platform localization export would be greatly appreciated. Is this a known limitation, or is there a recommended pattern I'm missing?