操纵体系底层支持了一些预置的关照动静,这些关照动静在头文件notify_keys.h中被声明。这些预置的动静有针对目次处事的、有针对磁盘空间和卷挂起的、有针对收集设置改变的、有针对写日记关照的、有针对体系时区和时刻改变的。每种详细的关照动静可以看文件中的声名,好比下面的例子实现对了对磁盘空间不敷,收集状态改变以及对换解了体系的时刻举办的监听处理赏罚:
- #include <notify.h>
- #include <notify_keys.h>
-
- void foo()
- {
- int token1, token2, token3;
- //注册监听收集状态改变的关照。
- notify_register_dispatch(kNotifySCNetworkChange, & token1, dispatch_get_main_queue(), ^(int token) {
- //...
- });
-
-
- //注册监听体系磁盘空间不敷的关照
- notify_register_dispatch(kNotifyVFSLowDiskSpaceRootFS, &token2, dispatch_get_main_queue(), ^(int token) {
- //....
- });
-
-
- //注册监听体系时刻被改变的关照。
- notify_register_dispatch(kNotifyClockSet, &token3, dispatch_get_main_queue(), ^(int token) {
- //...
- });
-
- }
除了notify_keys.h文件中果真的关照动静外,尚有一些未被果真的关照动静,我们可以通过这些未被果真的动静来获取更多关于体系状态的改变,下面的列表将列出全部的体系底层的关照动静,详细每个关照是什么意义就读者自行揣摩和验证吧。
- "com.apple.asl.remote"
- "com.apple.system.timezone"
- "com.apple.MCX._managementStatusChangedForDomains"
- "com.apple.CFPreferences._domainsChangedExternally"
- "com.apple.system.clock_set"
- "com.apple.system.timezone"
- "AppleNumberPreferencesChangedNotification"
- "AppleTimePreferencesChangedNotification"
- "AppleDatePreferencesChangedNotification"
- "AppleLanguagePreferencesChangedNotification"
- "AppleTextBehaviorPreferencesChangedNotification"
- "com.apple.librarian.account-token-changed"
- "com.apple.system.batterysavermode"
- "com.apple.accessibility.cache.forcetouch.sensitivity.changed"
- "com.apple.networkd.started"
- "com.apple.neconfigurationchanged"
- "com.apple.networkd.settings"
- "com.apple.system.config.network_change"
- "com.apple.CoreAnimation.CAWindowServer.DisplayChanged"
- "com.apple.networkd.proxy_count"
- "com.apple.iohideventsystem.available"
- "com.apple.backboardd.rawOrientation"
- "com.apple.springboard.hasBlankedScreen"
- "UIBacklightLevelChangedNotification"
- "com.apple.accessibility.wob.status"
- "com.apple.backboardd.videosettingschanged"
- "com.apple.mobile.keybagd.user_changed"
- "com.apple.LaunchServices.database"
- "com.apple.accessibility.cache.enhance.text.legibility"
- "com.apple.frontboard.systemappservices.serverNotifyToken"
- "com.apple.frontboard.workspace.serverNotifyToken"
- "com.apple.accessibility.cache.captioning"
- "com.apple.accessibility.cache.vot"
- "com.apple.accessibility.cache.ax"
- "com.apple.accessibility.cache.app.ax"
- "com.apple.accessibility.status"
- "com.apple.language.changed"
- "com.apple.springboard.showingAlertItem"
- "com.apple.mobile.keybagd.lock_status"
- "NameLayerTree"
- "ApplePreferredContentSizeCategoryChangedNotification"
- "kKeepAppsUpToDateEnabledChangedNotification"
- "com.apple.accessibility.cache.reduce.motion"
- "UIKeyboardSpringBoardKeyboardShow"
- "UIKeyboardSpringBoardKeyboardHide"
- "com.apple.locationd.registration"
- "kCTDaemonReadyNotification"
- "com.apple.system.config.network_change"
- "com.apple.system.timezone./var/db/timezone/zoneinfo/UTC"
- "com.apple.system.info:/etc/hosts"
- "com.apple.MSVLoggingConfigurationDidChange"
- "com.apple.managedconfiguration.defaultsdidchange"
- "com.apple.AppSupport.loggingDefaultsChanged"
- "com.apple.mobileipod.MPMusicPlayerController.launched"
- "com.apple.networkd.nat64.ifstate"
- "com.apple.ManagedConfiguration.profileListChanged"
- "com.apple.backboardd.unambiguousOrientation"
- "com.apple.accessibility.cache.button.shapes.enabled"
- "com.apple.accessibility.cache.use.single.system.color.enabled"
- "com.apple.accessibility.cache.darken.system.colors.enabled"
- "com.apple.coreui.statistics"
- "com.apple.UIKit.UIScreenEdgeGestureMode"
- "com.apple.managedconfiguration.restrictionchanged"
- "com.apple.managedconfiguration.passcodechanged"
- "PINPolicyChangedNotification"
- "com.apple.managedconfiguration.settingschanged"
- "com.apple.managedconfiguration.effectivesettingschanged"
- "com.apple.managedconfiguration.appwhitelistdidchange"
- "com.apple.managedconfiguration.defaultsdidchange"
- "com.apple.managedconfiguration.keyboardsettingschanged"
- "com.apple.managedconfiguration.clientrestrictionschanged"
- "com.apple.managedconfiguration.webFilterUIActiveDidChange"
- "com.apple.ManagedConfiguration.managedAppsChanged"
- "MCManagedBooksChanged"
- "com.apple.managedconfiguration.allowpasscodemodificationchanged"
- "com.apple.mediaserverd.up"
- "com.apple.hangtracer.prefchangednotification"
- "com.apple.accessibility.cache.enhance.background.contrast"
- "com.apple.system.thermalpressurelevel"
- "com.apple.backboardd.backlight.changed"
- "com.apple.accessibility.QuickSpeakEnabled"
- "com.apple.accessibility.cache.quick.speak"
- "com.apple.powerlog.state_changed"
- "com.apple.powerlog.clientPermissionState"
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|