问题
I use Xcode 10 and added all required stuff for DarkMode support. When I run the project on Mojave everything works. But when I archive and distribute the app using Xcode 10 on HighSierra, then my app doesn't appear in dark mode on Mojave. Shouldn't Xcode 10 archive Mojave compatible version anyway?
回答1:
Possible reasons:
- You are using command line to create the archive, but your toolchain is set to use Xcode 9
- You are using Dark Mode specific assets in asset catalog. Dark versions of those assets can only be compiled using Mojave.
回答2:
For some reason, the asset catalog created with Xcode 10 only contains the dark mode colors and images if Xcode is run on a macOS 10.14 Mojave system or newer! This means for full Dark Mode support it's not enough to just use Xcode 10, you must run Xcode on macOS 10.14 or newer.
The Cocoa APIs for Dark Mode can still be used, so you can compile an app supporting Dark Mode with Xcode 10 on macOS 10.13, but the asset support will be missing.
来源:https://stackoverflow.com/questions/52872730/darkmode-doesnt-work-on-mojave-when-exported-from-archive