Hi
This issue is present both in previous, current, and beta versions of Xcode
When a project has localization in packages, Xcode FAILS to export localization
The reason is that when trying to export in this configuration, the compiler will try to export using macOS sdk, but if the package support only iOS of course will not find symbols for frameworks and functions that are scoped only for iOS
This behaviour is not changed when the platforms for the package includes ".macOS("99") has I've found as a suggestion online
The only way to perform this operation is to run, from CLI the following command
xcodebuild -exportLocalizations -localizationPath . -sdk iphoneos -project TranslateTest.xcodeproj -exportLanguage en
The problem is that this command will not work when one of the packages contains a macro.
The following error will return in CLI if the macro is used (if the package is only imported no error appears)
error: external macro implementation type 'MyMacroMacros.StringifyMacro' could not be found for macro 'stringify'
I've found online some suggestions from apple folks that says to replace
-sdk iphoneos
with
-destination 'platform=iOS,name=Any iOS Device’
in case your project contains a macro, but this changes nothing in the final result, the export will fail
I'm providing a zip for apple in the radar (cannot upload zip here) that contains 3 example project for the 3 cases:
- A project without any packages that can extract its strings with any mode
- A project with a package that can only extract its strings only by CLI
- A project with multiple packages, one of which has a macro, and it can never extract its string
This problem affects any possibility to have a modularised application with localisations, macros, and packages.
Feedback FB13902424