简体   繁体   中英

Xcode Export Localisation doesn't export once I delete Mac as a destination in targets

See this as a minimal example,

  1. I created a simple SwiftUI based app in Xcode Version 14.2 (14C18), with one simple view.

  2. At this point in time, I can export localisations without an issue.

  3. When I deleted Mac as a supported destination (see Figure 1), and try to export localisations, it doesn't report an error but it doesn't update the "Hello World" even if I change it to "Goodbye world" in the code.

  4. And if I clean build folder, it stops exporting the text "hello world" altogether.

图1

https://github.com/liyezhou/ExportLanguageTest

Text("Hello World xxxx")

In this GitHub, latest commit doesn't export localisations if you go to "Product - Export Localisations" in Xcode. But the second last commit before I delete Mac as a destination, it still works.

I checked "Use compiler to extract swift strings" and "localised string swiftUI support" and they are both set to "YES"

I found that this only occurs if you chose multi-platform app when you created the project. So I went into Build Settings in the Target Settings and changed base SDK from Automatic to iOS and it fixed it!

Hopes it saves someone else a few hours of their night…

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM