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
.xcstringsfiles 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
-exportLocalizationsflag appears to ignore-destinationand-sdkflags - 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 -exportLocalizationsto specific platforms? The documentation doesn't mention any flags for this, and-destination/-sdkappear to be ignored. -
Why does
-exportLocalizationsrequire building ALL targets across ALL platforms? Both the Xcode GUI (Product → Export Localizations) andxcodebuild -exportLocalizationsfail 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
.xcstringsfiles and generating XLIFF an acceptable alternative, or does this miss important metadata that-exportLocalizationswould 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?
Thank you for the info!
This doesn't seem to affect our "normal" build because the relevant watch packages don't depend on the libraries that aren't compatible. But for some reason when -exportLocalization flag is added, it attempts to build ALL targets for watch since that's declared as a platform at the top.
This makes sense to me now. Xcode does indeed attempt to build each target in the package for all platforms listed in that package.
The reason changing those build settings didn't work for you is because they would need to be set on the relevant package targets themselves (not the dependencies), but packages do not allow setting arbitrary build settings.
Please file a Feedback report requesting that the Export feature avoid building package targets for platforms that their dependencies do not support. A sample project is helpful but not required since we now understand what the problem is.