Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当iOS设备接通电源时唤醒应用程序_Ios - Fatal编程技术网

当iOS设备接通电源时唤醒应用程序

当iOS设备接通电源时唤醒应用程序,ios,Ios,当iOS设备插入或拔出电源时,是否可以在后台通知应用程序?您需要两个功能: CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context); // to subscrive to a notification of a power source being changed 及 这里描述了这两种情况: 我不确定它是否能在后台模式下工作,但你可以试试

当iOS设备插入或拔出电源时,是否可以在后台通知应用程序?

您需要两个功能:

CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context);
// to subscrive to a notification of a power source being changed

这里描述了这两种情况:

我不确定它是否能在后台模式下工作,但你可以试试

CFTypeRef IOPSCopyPowerSourcesInfo(void);
// to get info about your current power source