Reputation: 14856
Following an answer I found here: https://stackoverflow.com/a/18121292/1701170, I have the following code:
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
}
The error I get is as follows:
[apply] error: use of undeclared identifier 'NSDictionary'; did you mean 'UseDictionary'?
[apply] NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
[apply] ^~~~~~~~~~~~
[apply] UseDictionary
Do I have to import NSDictionary?
The imports at the top of the file are as follows:
#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"
This is my first time looking at Objective-C.
Upvotes: 0
Views: 1137
Reputation: 40211
The project you linked looks like a plain C project to me. NSDictionary is an Objective-C class and part of the Foundation framework from Apple. You have to link Foundation.framework and make sure it is imported in your source. If you're just experimenting, your best bet would probably be to just create a new project in Xcode using the Command Line Tool (of type Foundation) template.
Upvotes: 3