I received this error from Apple at the time of publication of my application. how can I solve this problem? We found that when Dark Mode is enabled, the menu bar extra icons aren't visible. I can not find anything online to define Dark mode...
I see the term cache
in your code and taking some guesses:
It looks like you are loading the images, then manipulating them and storing the manipulated images for later use. There are a number of things you need to take care of:
First of all, make sure the current appearance is set correctly when you do your image loading/manipulation. Outside of drawRect:
and a few other methods, you always need to do a dance similar to this:
NSAppearance * savedAppearance = [NSAppearance currentAppearance];
[NSAppearance setCurrentAppearance:someView.effectiveAppearance];
// Do your image/color/drawing stuff.
[NSAppearance setCurrentAppearance:savedAppearance];
Be aware that the appearance is "scoped" to a specific view! You can have different appearances in the same view hierarchy.
You need to either override viewDidChangeEffectiveAppearance
of your NSView
or KVObserve the effectiveAppearance
of a view to get notified about appearance changes and react accordingly (recreate your icons).