Sandbox suppressing accessibility prompt - macos

My app implements a hotkey so I'm using AXIsProcessTrustedWithOptions to check and prompt for accessibility permissions so I can set up the hotkey with CGEventTapCreate/CFMachPortCreateRunLoopSource/CFRunLoopAddSource.
It all works fine unless the app is sandboxed, in which case the prompt doesn't appear and the app isn't added to the list in the accessibility section of the Privacy and Security dialog in system preferences.
I've tried all combinations that I can think of in terms of signing (Mac App Distribution, Apple Distribution, Developer etc.)
This is the code which enables/disables the hotkey - it works if sandbox is disabled. If sandbox is enabled, the call to AXIsProcessTrustedWithOptions returns false and doesn't show the prompt (or add the app to the list in system preferences).
- (void)setup_hotkey
{
LOG(#"setup_hotkey: enabled = %d", settings.hotkey_enabled);
if (settings.hotkey_enabled) {
if (!hotkey_installed) {
NSDictionary *options_prompt = #{(__bridge id)kAXTrustedCheckOptionPrompt : #YES};
if (AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)options_prompt)) {
LOG(#"permissions OK");
hotkey_tap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault,
CGEventMaskBit(kCGEventKeyDown), on_hotkey, (__bridge void *)self);
hotkey_runloop_source_ref = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, hotkey_tap, 0);
CFRunLoopAddSource(CFRunLoopGetMain(), hotkey_runloop_source_ref, kCFRunLoopCommonModes);
hotkey_installed = true;
} else {
LOG(#"still need permissions");
settings.hotkey_enabled = false;
[self show_options_window];
}
}
} else if (hotkey_installed) {
LOG(#"remove hotkey");
CFRunLoopRemoveSource(CFRunLoopGetMain(), hotkey_runloop_source_ref, kCFRunLoopCommonModes);
hotkey_tap = nil;
hotkey_runloop_source_ref = nil;
hotkey_installed = false;
}
}
The project settings look like this (as mentioned, I've tried all the certificate types, the behaviour is the same regardless of which one I use). I've tried adding User Selected File/Read-Only but that made no difference. I've also tried Automatic Signing and basically every other combination of settings on this page that I can find. The only way that I've found so far to make the prompt appear is to remove the Sandbox setting.
The entitlements file looks like this:
and it is being correctly referenced in the project settings.
I've tried Debug/Release (the settings are the same for both) and running the app in the debugger or from Finder. Same results regardless.
I'm building with XCode 12.4, running on Catalina 10.15.7 (Build 19H2026). These are the most recent versions I can use on the Mac that I have.
So the question is: Am I doing something wrong in the setup_hotkey function? Is there some flag or parameter which needs to be changed? And if not, is there some official signing/entitlement setting which is wrong or missing?
I've looked at accessibility-api-stops-working-after-sandboxing which references some ancient Apple documentation but I can't find any more recent docs on this. My understanding is that Sandboxed app can be granted the accessibility privilege in Catalina but am I mistaken there?
I've tried notarizing it and then running the notarized app from the Applications folder - still no prompt...

Related

Electron app crashes when I ask permission to use camera. Error message asks for string in com.apple.security.device.camera. Shouldn't it be boolean?

I have an Electron app that needs access to the camera. On Windows it works fine but on MacOS it doesn't and even crashes when I try to ask permisson.
When I call the routine to check the permission status (shown bellow) it gives me a not-determined answer.
systemPreferences.getMediaAccessStatus('camera')
Then, to ask for permission (and hopefully show the allow/deny pop-up) I use the following:
const { systemPreferences } = require('electron')
systemPreferences.askForMediaAccess('camera')
But when I do, it instantaneously crashes the app and gives me a long detailed crash report that, among other things, says this:
This app has crashed because it attempted to access privacy-sensitive data without a usage description.
The app's Info.plist must contain an com.apple.security.device.camera key with a string value explaining to the user how the app uses this data.
Additionally, the Info.plist generated in the root of the app instalation has all of the entries needed. I even included the hardenedRuntime as true.
<key>NSCameraUsageDescription</key>
<string>This app needs access to the Camera</string>
<key>com.apple.security.device.camera</key>
<true/>
<key>hardenedRuntime</key>
<true/>
Some final notes...
I was struggling with app signing and finally made it to use a valid certificate to sign during the build. Before that the app did not crash when I asked for the permission. It simply did nothing at all. The crashing started as soon as I managed to sign the App.
I'm using electron-builder to build the .dmg and installing from that. npm run electron:build. When I run the app in dev mode through npm run electron:serve it works perfectly and doesn't even pop the permission pop-up. The access status returns as granted.
Shouldn't com.apple.security.device.camera be a boolean? Everywhere I read about it it is a Boolean. Although the error message asks me to define a string with a description. (which I already tried and did not change anything)
Any ideas on how to solve that?
I already tried to change the Info.plist mannualy. Didn't work. How can I make sure I'm working on the right Info.plist file. There are a few. The one I was using is the largest and seems to be the main one. The others are helpers.
I also tried to manage the permission in the MacOS System Preferences. Did not work either.
Try to add "com.apple.security.cs.allow-unsigned-executable-memory": true
mac: {
....
extendInfo: {
"NSCameraUsageDescription": "some description",
"com.apple.security.device.camera": true,
"com.apple.security.cs.allow-unsigned-executable-memory": true
}
}

Which APIs trigger "app would like to control this computer using accessibility features"?

I've noticed that on newer macOS versions my app suddenly shows this security warning:
(screenshot taken from here because my system is in German)
Now I'm wondering why macOS is showing this. I don't remember using any accessibility features but of course I must be using some because otherwise this security warning would not appear. I've checked my code and I'm not using any features from NSAccessibility. But since I get this warning, there must be other calls that trigger it as well. But how to find them?
That's why I'd like to ask how I can find out what Cocoa APIs are actually causing this security warning to appear? What should I look for? Is there a list of functions/classes that trigger this warning?
Note that I'm not using Xcode but I'm building my app in a very old-fashioned way using a set of makefiles.
This is not really a complete answer to the question but at least I've found out the culprit now. I had some code in there that allowed the user to programmatically move the mouse cursor. Disabling this code made the warning go away. The code looks like this:
CGPoint p;
CGEventRef me;
p.x = x;
p.y = y;
if(!(me = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, p, 0))) return;
CGEventPost(kCGHIDEventTap, me);
CFRelease(me);

macOS Swift monitoring global events not working for generic keyDown

I did set the necessary privileges for the app, and for some events it is working.
For instance:
NSEvent.addGlobalMonitorForEvents(matching: .flagsChanged) {
print("\($0)")
}
works, but
NSEvent.addGlobalMonitorForEvents(matching: .keyDown) {
print("\($0)")
}
doesn't.
So I am wondering, is it possible at all to listen globally for any keypress?
After checking the privileges via
let accessEnabled = AXIsProcessTrustedWithOptions(
[kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary)
I found out, that due to the program running through the Xcode debugger granting the privileges to the app was not enough, I also had to give the privileges to Xcode itself.
schnesim is right!!!
but one thing that the answer failed to mention is that every time you change something in a running section of code, you have to go back into preferences and disable, then reenable the permission for the app(not for xcode though) I struggled with that for hours.

XCode 4.3 organizer crash

I've installed the XCode 4.3. I've seen that in preferences general tab, there is the "iOS device discovery" tab. Maybe it was there before too, but I just noticed now.
So I've checked it, after this I can do anything, but the XCode crashes constantly when I try to access the organizer's devices tab.
Any clues for solution?
Update: I've deleted it and reinstalled it from the Mac App Store, but it didn't help
Update: I've submitted the bug to Apple, they marked it as duplicate and after this they closed both of them. So, I hope we will have a solution from Apple.
I can't take full credit for this. I found it here and added a little bit to the end that I needed in my case.
Create readcert.m with these contents:
#import <Security/Security.h>
#import <Foundation/Foundation.h>
void checkCerts () {
OSStatus status;
const void *keys[] = {
kSecClass,
kSecReturnRef,
kSecMatchLimit
};
const void *values[] = {
kSecClassCertificate,
kCFBooleanTrue,
kSecMatchLimitAll
};
CFDictionaryRef query = CFDictionaryCreate(NULL, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFArrayRef results;
if ((status = SecItemCopyMatching((CFDictionaryRef) query, (CFTypeRef *)&results)) != noErr) {
NSLog(#"Failed to copy certificates: %d", status);
return;
}
CFIndex count = CFArrayGetCount(results);
CFIndex i;
for (i = 0; i < count; i++) {
SecCertificateRef cert = (SecCertificateRef) CFArrayGetValueAtIndex(results, i);
CFErrorRef error;
CFDictionaryRef vals = SecCertificateCopyValues(cert, NULL, &error);
if (vals == NULL) {
CFStringRef subjectSummary = SecCertificateCopySubjectSummary(cert);
NSLog(#"Found a triggering certificate: %#", subjectSummary);
}
}
CFRelease(results);
}
int main (int argc, char *argv[]) {
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
checkCerts();
[p release];
return 0;
}
Then, compile it with:
clang -o readcert readcert.m -framework Security -framework Foundation
Then run it:
./readcert
It should output the name of the bad certificate. In my case, it was a certificate from a Linksys router. I deleted the certificate from my keychain, but Xcode was still crashing and readcert was still saying it was there, so I ended up executing this command.
sudo security delete-certificate -c Linksys_WRVS4400Nv2
I'm not sure where the certificate was coming from, I didn't see it in the login or system keychains, but after deleting it from the command line, everything was peachy again in Xcode.
Same Problem here. I just created a new user on my system. With it I have no problem open the Devices in the Organizer Window.... strange...
Edit: I've deleted one certificate in my keychain that solve the problem for me. It was a certificate which was not trustful. Maybe this will help you.
Note that the "harmful" certificate might not be a development certificate or related to development/provisioning at all. Make sure to check for "Certificates", not just "My certificates" in Keychain. The culprit could be any certificate, like a company-signed SSL certificate etc.
Same Problem. Not happy. I have a hard time believing apple released this in such a state. XCode has crashed at least 25x today on me.
I solved the problem. I don't know if its the best solution, but after five days I'm happy to have Xcode working again.
I solved the problem by doing two things. Resetting my Keychain under Lion and revoking my existing provisioning profiles.
So first, reset your Keychain under Lion (http://support.apple.com/kb/TS1544). This will make the Organizer launch without crashing.
Unfortunately, now you can't deploy your software because you killed all the certs in the keychain. So now you need to revoke all your developer certs (developer.apple.com/membercenter) and delete the provisioning profiles from your Organizer. Then tell the Organizer to refresh.
It will restore all your sick profiles, but will also create at least one healthy one.
The new version of Xcode tries to be helpful, and wants to handle all your cert needs for you. So bring up an Xcode project, and set code signing to the new provisioning profile. Compile, and everything will work again.
As I said, may not be the best solution, but deleting old certs from the Keychain and extra prefs files did nothing to help me. If all else fails, try this recipe and it will probably help.
Finally figured this out. The problem for me was with the my dev device and not XCode. I restored my device to the factory defaults. Now XCode won't crash when the device is plugged in.
Before I reset the device, I tried just deleting all the certificates on the device. However, XCode still crashed. That's the only other step I took on the device before reseting it.
3/22/12 UPDATE: Apple released a new version of XCode today. From the release notes:
Additional bug fixes and stability improvements
Hopefully this fixes the issue for most people.
4/11/12 UPDATE
I started to have issues again with XCode. A colleague suggested I clear out the XCode cache for my project, which was located here for me:
~/Library/Developer/Xcode/DerivedData/your_app_name-abunchofletters
Within that folder run:
rm -r *
XCode no longer crashes when plugging in my dev device.
and again here.. I noticed my iphone would wake up after these crashes - it syncs via wifi.
I thought it fixed the problem yesterday until I started work today.. I can't work like this.. I'm already looking for an alternative.
I can force it to crash Today (for something different from Apple) File > Open > And select the programming folder where all the work is..Boom! Every Time..
Bottom Line: No Apple App release expected Today...
Same here. Check out your the System logs. For me it seems to be a bogus USB connection. I see stuff like that in the logs (console app):
27.02.12 13:34:16,537 com.apple.usbmuxd: _SendAttachNotification (thread 0x7fff756c7960): sending attach for device xxx._apple-mobdev._tcp.local.: _GetAddrInfoReplyReceivedCallback matched.
And then
27.02.12 13:34:20,407 [0x0-0x6b06b].com.apple.dt.Xcode: garbage pointer stored into reachable memory, break on auto_zone_resurrection_error to debug
27.02.12 13:34:20,425 [0x0-0x6b06b].com.apple.dt.Xcode: Xcode(2099,0x114d85000) malloc: * error for object 0x7fef55278cb0: pointer being freed was not allocated
Interestingly right after that tere is a backupd process that tries to start the time machine backup. Maybe related - I'll keep an eye on it.
I tried removing certificates as others have suggested and even reset my Keychain. However this had no affect and opening the organiser always causes a crash/hang.
My fix was to remove some of the Xcode settings files. Specifically I removed the following:
~/Library/Developer/Xcode/UserData/IDEOrganizerWindowController.xcuserstate
~/Library/Developer/Xcode/UserData/IDEPreferencesController.xcuserstate
~/Library/Developer/Xcode/UserData/KeyBindings
The solution to this Xcode problem seems to vary, but I had not seen anyone else post this solution, so I hope it will help others. Remember I had gone through the Keychain reset before getting to this, so I'm not ruling out a keychain reset with this solution.
This isn't a real fix, but if you open up Activity Monitor, filter for bash, and continue to close/force close that process, xCode will regain consciousness.
If above solutions dosen't work then try installing previous version of your xcode using time machine.
Really it worked for, apple updates is creating problem.
I deleted all old certificates which were not trustful. Even after doing so, my Xcode 4.5 crashed while opening organizer.
Hard Resetting the Xcode fixed my problem.
Fire up your terminal.
Type "defaults delete com.apple.Xcode" and press "Enter." This deletes the customized settings set up.
Sometimes if you have more than one version of Xcode installed the defaults bundle identifier could be different. You can check lists of bundles identifiers by allowing terminal to show possibilites by pressing Tab button.
Type "rm -rf ~/Library/Application\ Support/Xcode" and press "Enter." This removes the configuration folders as well.
Now open up an Xcode and it will show you agreement page. In this way my Xcode worked as expected.
I hope it might be help to someone.
I tried all the above and couldn't, the solution I found was really simple:
Go to ~/Library/Developer/ , inside this folder has a folder Xcode, all I did was renaming the existent one and reopen Xcode, then Xcode created a new folder name Xcode and everything started to work again.
Hope that helps.
I had this same error on Xcode 5.0 whenever I went to the Devices tab. The solution was found by looking at Applications->Utilities->Console. It was attempting to write to a read-only device logs database which then meant it couldn't instantiate the object model (ORM) and context for that database. The crash description was "Cannot perform operation without a managed object context".
Removing ~/Library/Developer/Xcode/iOS Device Logs/* and ~/Library/Developer/Xcode/iOS Device Logs*.db meant that it recreated the (now empty) .db file on startup with the right permissions, and everything works fine now.

Cocoa button opens a System Preference page

In a OSX Cocoa app, I would like a button that would open the "speech" preference pane. Is that possible? I'm just trying to save them the time to go System Preferences > Speech > Text to Speech
One can even select specific sub item inside a pref pane.
Here is example to select Camera under Privacy pane:
NSURL *URL = [NSURL URLWithString:#"x-apple.systempreferences:com.apple.preference.security?Privacy_Camera"];
[[NSWorkspace sharedWorkspace] openURL:URL];
Some credit goes to following site: https://macosxautomation.com/system-prefs-links.html
List of URLs for reference (*updated for macOS Big Sur & Catalina & Mojave):
Accessibility Preference Pane
Main x-apple.systempreferences:com.apple.preference.universalaccess
Display x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Display
Zoom x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Zoom
VoiceOver x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_VoiceOver
Descriptions x-apple.systempreferences:com.apple.preference.universalaccess?Media_Descriptions
Captions x-apple.systempreferences:com.apple.preference.universalaccess?Captioning
Audio x-apple.systempreferences:com.apple.preference.universalaccess?Hearing
Keyboard x-apple.systempreferences:com.apple.preference.universalaccess?Keyboard
Mouse & Trackpad x-apple.systempreferences:com.apple.preference.universalaccess?Mouse
Switch Control x-apple.systempreferences:com.apple.preference.universalaccess?Switch
Dictation x-apple.systempreferences:com.apple.preference.universalaccess?SpeakableItems
Security & Privacy Preference Pane
Main x-apple.systempreferences:com.apple.preference.security
General x-apple.systempreferences:com.apple.preference.security?General
FileVault x-apple.systempreferences:com.apple.preference.security?FDE
Firewall x-apple.systempreferences:com.apple.preference.security?Firewall
Advanced x-apple.systempreferences:com.apple.preference.security?Advanced
Privacy x-apple.systempreferences:com.apple.preference.security?Privacy
Privacy-Camera x-apple.systempreferences:com.apple.preference.security?Privacy_Camera
Privacy-Microphone x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone
Privacy-Automation x-apple.systempreferences:com.apple.preference.security?Privacy_Automation
Privacy-AllFiles x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles
Privacy-Accessibility x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility
Privacy-Assistive x-apple.systempreferences:com.apple.preference.security?Privacy_Assistive
Privacy-Location Services x-apple.systempreferences:com.apple.preference.security?Privacy_LocationServices
Privacy-SystemServices x-apple.systempreferences:com.apple.preference.security?Privacy_SystemServices
Privacy-Advertising x-apple.systempreferences:com.apple.preference.security?Privacy_Advertising
Privacy-Contacts x-apple.systempreferences:com.apple.preference.security?Privacy_Contacts
Privacy-Diagnostics & Usage x-apple.systempreferences:com.apple.preference.security?Privacy_Diagnostics
Privacy-Calendars x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars
Privacy-Reminders x-apple.systempreferences:com.apple.preference.security?Privacy_Reminders
Privacy-Facebook x-apple.systempreferences:com.apple.preference.security?Privacy_Facebook
Privacy-LinkedIn x-apple.systempreferences:com.apple.preference.security?Privacy_LinkedIn
Privacy-Twitter x-apple.systempreferences:com.apple.preference.security?Privacy_Twitter
Privacy-Weibo x-apple.systempreferences:com.apple.preference.security?Privacy_Weibo
Privacy-Tencent Weibo x-apple.systempreferences:com.apple.preference.security?Privacy_TencentWeibo
macOS Catalina 10.15:
Privacy-ScreenCapture x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture
Privacy-DevTools x-apple.systempreferences:com.apple.preference.security?Privacy_DevTools
Privacy-InputMonitoring x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent
Privacy-DesktopFolder x-apple.systempreferences:com.apple.preference.security?Privacy_DesktopFolder
Privacy-DocumentsFolder x-apple.systempreferences:com.apple.preference.security?Privacy_DocumentsFolder
Privacy-DownloadsFolder x-apple.systempreferences:com.apple.preference.security?Privacy_DownloadsFolder
Privacy-NetworkVolume x-apple.systempreferences:com.apple.preference.security?Privacy_NetworkVolume
Privacy-RemovableVolume x-apple.systempreferences:com.apple.preference.security?Privacy_RemovableVolume
Privacy-SpeechRecognition x-apple.systempreferences:com.apple.preference.security?Privacy_SpeechRecognition
macOS Big Sur 10.11/10.16:
Privacy-Bluetooth x-apple.systempreferences:com.apple.preference.security?Privacy_Bluetooth
Privacy-Music x-apple.systempreferences:com.apple.preference.security?Privacy_Media
Privacy-Home x-apple.systempreferences:com.apple.preference.security?Privacy_HomeKit
macOS Monterey 12.0:
Privacy-DoNotDisturb x-apple.systempreferences:com.apple.preference.security?Privacy_Focus
macOS Ventura 13.0:
Privacy-AppBundles x-apple.systempreferences:com.apple.preference.security?Privacy_AppBundles
Privacy-ListenEvent x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent
Dictation & Speech Preference Pane
Dictation x-apple.systempreferences:com.apple.preference.speech?Dictation
Text to Speech x-apple.systempreferences:com.apple.preference.speech?TTS
Sharing Preference Pane
Main x-apple.systempreferences:com.apple.preferences.sharing
Screen Sharing x-apple.systempreferences:com.apple.preferences.sharing?Services_ScreenSharing
File Sharing x-apple.systempreferences:com.apple.preferences.sharing?Services_PersonalFileSharing
Printer Sharing x-apple.systempreferences:com.apple.preferences.sharing?Services_PrinterSharing
Remote Login x-apple.systempreferences:com.apple.preferences.sharing?Services_RemoteLogin
Remote Management x-apple.systempreferences:com.apple.preferences.sharing?Services_ARDService
Remote Apple Events x-apple.systempreferences:com.apple.preferences.sharing?Services_RemoteAppleEvent
Internet Sharing x-apple.systempreferences:com.apple.preferences.sharing?Internet
Bluetooth Sharing x-apple.systempreferences:com.apple.preferences.sharing?Services_BluetoothSharing
Software update x-apple.systempreferences:com.apple.preferences.softwareupdate?client=softwareupdateapp
All this is possible thanks to key in Info.plist in preferencePane + CFBundleURLTypes (CFBundleURLSchemes) x-apple.systempreferences (Info.plist) in System Preferences.app
NSPrefPaneAllowsXAppleSystemPreferencesURLScheme
As of 10.15 some of the keys are located in PrivacyTCCServices.plist (Security.prefPane)
As of 10.14 Mojave some Privacy keys ceased to exists. Mojave privacy list:
Catalina privacy list:
The following is a fairly easy (and reliable) way to at least get System Preferences open to the Speech.prefPane:
- (IBAction)openSpeechPrefs:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:
[NSURL fileURLWithPath:#"/System/Library/PreferencePanes/Speech.prefPane"]];
}
However, it won't necessarily be switched to the Text to Speech tab, but rather the last tab the user had selected.
It is possible to actually switch to the Text to Speech tab as well, but it's a bit more involved. You can use AppleScript to send commands to the System Preferences application, but using the ScriptingBridge.framework (See Scripting Bridge Programming Guide) is much faster.
You'll need to add the ScriptingBridge.framework to your project, and then use a command like the following in Terminal to generate a SBSystemPreferences.h header file to work with:
sdef "/Applications/System Preferences.app" | sdp -fh --basename SBSystemPreferences -o ~/Desktop/SBSystemPreferences.h
Add that SBSystemPreferences.h header to your project, then change -openSpeechPrefs: to the following:
- (IBAction)openSpeechPrefs:(id)sender {
SBSystemPreferencesApplication *systemPrefs =
[SBApplication applicationWithBundleIdentifier:#"com.apple.systempreferences"];
[systemPrefs activate];
SBElementArray *panes = [systemPrefs panes];
SBSystemPreferencesPane *speechPane = nil;
for (SBSystemPreferencesPane *pane in panes) {
if ([[pane id] isEqualToString:#"com.apple.preference.speech"]) {
speechPane = pane;
break;
}
}
[systemPrefs setCurrentPane:speechPane];
SBElementArray *anchors = [speechPane anchors];
for (SBSystemPreferencesAnchor *anchor in anchors) {
if ([anchor.name isEqualToString:#"TTS"]) {
[anchor reveal];
}
}
}
EDIT:
Sample project using the ScriptingBridge.framework method:
http://github.com/NSGod/OpenSystemPrefsTTS
For the guys who run into the same issue that I mentioned in the comment, just go to the ~/Desktop (cos I specify this position) and you'll see the SBSystemPreferences.h has been created.
However, in this header, some class declarations are missing. So you have to add this declarations explicitly.
In my case, class "item" is undefined. So add this:
#class SBSystemPreferencesItem;
Then compile it and see what's still missing, which declaration needs to be added.

Resources