SBSystemPreferencesApplication *systemPrefs =
[SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"];
[systemPrefs activate];
SBElementArray *panes = [systemPrefs panes];
SBSystemPreferencesPane *notificationsPane = nil;
for (SBSystemPreferencesPane *pane in panes) {
if ([[pane id] isEqualToString:@"com.apple.preferences.extensions"]) {
notificationsPane = pane;
break;
}
}
[systemPrefs setCurrentPane:notificationsPane];
SBElementArray *anchors = [notificationsPane anchors];
for (SBSystemPreferencesAnchor *anchor in anchors) {
if ([anchor.name isEqualToString:@"Extensions"]) {
[anchor reveal];
}
}
当然,您需要将ScriptingBridge框架添加到项目中,并为系统首选项添加脚本桥头文件。关于如何使用脚本桥的更多详细信息,您可以在Apple的开发人员文档中找到。
希望这有帮助