Rework this recently introduced test case to insure that it works with
older versions of the OS. It was using a new framework library not
available on pre-10.14 to trigger the weak symbol reference; switch to
using a new symbol from an existing library. Tested on MacOS 10.14 and
10.11.
Updates #32233.
Change-Id: I1fe2a9255fca46cb7cdf33ff7fed67bba86fdc22
Reviewed-on: https://go-review.googlesource.com/c/go/+/179837
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
// license that can be found in the LICENSE file.
#import <Foundation/Foundation.h>
-#import <UserNotifications/UserNotifications.h>
+#import <AppKit/NSAppearance.h>
BOOL function(void) {
+#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (MAC_OS_X_VERSION_MIN_REQUIRED > 101300)
+ NSAppearance *darkAppearance;
if (@available(macOS 10.14, *)) {
- UNUserNotificationCenter *center =
- [UNUserNotificationCenter currentNotificationCenter];
+ darkAppearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
}
+#endif
return NO;
}
package lib
/*
-#cgo darwin CFLAGS: -mmacosx-version-min=10.10 -D__MAC_OS_X_VERSION_MAX_ALLOWED=101450 -Wunguarded-availability-new
-#cgo darwin LDFLAGS: -framework Foundation -framework UserNotifications
+#cgo darwin CFLAGS: -D__MAC_OS_X_VERSION_MAX_ALLOWED=101450
+#cgo darwin LDFLAGS: -framework Foundation -framework AppKit
#include "stdlib.h"
int function(void);
*/