为什么 `#import <HIToolbox/Events.h>` 会失败?

Why does `#import <HIToolbox/Events.h>` fail?

我需要 kVK_Space,它位于 HIToolbox/Events.h:

#import <Carbon/Carbon.h>

有效,此文件包含:

#include <HIToolbox/HIToolbox.h>

但是如果我直接尝试第二次 #include,它会失败。

谁能解释为什么?

碳是 "umbrella framework"。它封装了其他框架,比如HIToolbox。按照设计,为了隐藏实现细节,您不能直接包含子框架的 headers。

从上面link:

[T]wo factors distinguish umbrella frameworks from other frameworks. The first is the manner in which they include header files.

Unlike standard frameworks, the Headers directory of an umbrella framework contains a more limited set of header files. It does not contain a collection of the headers in its subframeworks. Instead, it contains only the master header file for the framework. When referring to an umbrella framework in your source files, you should include only the master header file. See Including Frameworks for more information.

从最后一个 link:

[I]f you are including an umbrella framework, you must include the master header file. Umbrella frameworks do not allow you to include the headers of their constituent subframeworks directly.