继答案我发现这里:https://stackoverflow.com/a/18121292/1701170,我有以下代码:如何正确声明和使用NSDictionary?
bool accessibilityEnabled = false;
// Check and make sure assistive devices is enabled.
if (AXIsProcessTrustedWithOptions != NULL) {
// 10.9 and later
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
} else {
// 10.8 and older
if (AXAPIEnabled() == true) {
accessibilityEnabled = true;
}
}
if (accessibilityEnabled) {
// do something
}
我得到的错误如下:
[apply] error: use of undeclared identifier 'NSDictionary'; did you mean 'UseDictionary'?
[apply] NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
[apply] ^~~~~~~~~~~~
[apply] UseDictionary
我一定要导入的NSDictionary?是
在文件顶部的进口如下:
#include <pthread.h>
#include <sys/time.h>
#include <ApplicationServices/ApplicationServices.h>
#include "NativeErrors.h"
#include "NativeGlobals.h"
#include "NativeHelpers.h"
#include "NativeThread.h"
#include "NativeToJava.h"
#include "OSXInputHelpers.h"
这是我第一次看的Objective-C。
你创造什么模板从这个项目?你链接了基金会吗?它是否正确导入? – DrummerB
另外,不要把标签在你的职称,多亏 – DrummerB
这是https://code.google.com/p/jnativehook/我在看的src /本地/ OSX/NativeThread.c,围绕线665个 – jononomo