0
當iOS設備插入電源或拔下電源時,是否可以通知後臺有應用程序?當iOS設備插入電源時喚醒應用程序
當iOS設備插入電源或拔下電源時,是否可以通知後臺有應用程序?當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
兩者都描述如下:IOPowerSource
我不知道是不是要在後臺模式或不工作,但你可以試試。