Gautham Pai
Gautham Pai

Reputation: 618

macOS App Crashes on 10.13 with Symbol not found: _NSAppearanceNameDarkAqua

I am building a macOS app with Deployment Target 10.13

Works on 10.15 but crashes on 10.13

Termination Reason:    DYLD, [0x4] Symbol missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: _NSAppearanceNameDarkAqua

Upvotes: 0

Views: 1086

Answers (2)

James Bucanek
James Bucanek

Reputation: 3439

You'll need to make the code that uses this variable dependent on the version of macOS that's executing:

if (@available(macOS 10.14, *)) {
    return NSAppearanceNameDarkAqua;
} else {
    return nil;
}

You can also go old-school and declare it as a weak link:

extern NSAppearanceName const NSAppearanceNameDarkAqua __attribute__((weak_import));
...
if (NSAppearanceNameDarkAqua!=NULL) {
    ...

Upvotes: 2

matt
matt

Reputation: 535989

Makes sense; dark mode wasn't introduced until 10.14. So if you're going to run on 10.13, you mustn't load anything — not code, not asset catalog, not storyboard — that "mentions" or depends upon light/dark mode.

Upvotes: 0

Related Questions