我想在应用程序中打开/关闭低功耗模式。是否可以从iOS应用程序控制电池模式。
Apple 尚未公开任何公共 API 来允许控制低功耗模式。
但是我们可以 检测低功耗模式 使用以下代码 ,Apple文档中提供的详细信息
目标C
if ([[NSProcessInfo processInfo] isLowPowerModeEnabled]) {
// Low Power Mode is enabled. Start reducing activity to conserve energy.
} else {
// Low Power Mode is not enabled.
}
迅速
if ProcessInfo.processInfo.isLowPowerModeEnabled {
// Low Power Mode is enabled. Start reducing activity to conserve energy.
} else {
// Low Power Mode is not enabled.
}