Search code examples
swiftxcodelocalizationxcodebuild

WARNING: No screenshots were found for '( locale )' when trying to -exportLocalizations


I have a set of XCUITests that step through a Swift-based application. In the test plan configuration, I've selected to create Localization screenshots for the Dutch language.

test plan config

When I then try to export the localization from XCode 12.5, I am able to see Dutch as an option and the screenshots export as I would expect.

However, when I attempt to actually export them from the command line (which I need to do in order to embed them in automation), I get an error:

xcodebuild -exportLocalizations -project 'test/test-inhouse.xcodeproj' -localizationPath localizations_output -exportLanguage nl -includeScreenshots
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -exportLocalizations -project test/test-inhouse.xcodeproj -localizationPath localizations_output -exportLanguage nl -includeScreenshots

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

--- xcodebuild: WARNING: No screenshots were found for '(
    nl
)'

It doesn't matter what spelling I use, or if I put in Dutch. The error is always similar, it can't find the screenshots. I even looked at the project.pbxproj to ensure I'm putting it in exactly as is in the array.

I'm trying to not introduce further dependencies to our CI process, and simply use the built-in XCodeBuild command. Any thoughts on why it can't find the screenshots? Do I have to also specify what device type was built to or something?


Solution

  • It turned out that I was using a project instead of a workspace reference.

    From what I can tell, a project is only a single compilable set of code and targets.

    Our UITest target is actually a separate compilable object, so when I exported localizations with screenshots for workspace instead of project, it worked.