2017-07-28 79 views

回答

0

它不是iOS10工作,你可以找到UIDeviceListener Github上的更多信息發出https://github.com/eldade/UIDeviceListener/issues/3

您可以使用由於IOKit:

mach_port_t iokitPort = 0; 
CFMutableDictionaryRef properties; 
IOMasterPort(0, &iokitPort); 
CFDictionaryRef serviceName = IOServiceNameMatching("AppleARMPMUCharger"); 

io_service_t service = IOServiceGetMatchingService(iokitPort, serviceName); 

if (service == 0) 
    return nil; 

kern_return_t status = IORegistryEntryCreateCFProperties(service, 
                  &properties, 
                  kCFAllocatorDefault, 
                  kNilOptions); 

IOObjectRelease(service); 
+0

如果我使用由於IOKit,應用程序將在AppStore的拒絕? –

+0

它可能會被拒絕是 –

+0

我不想取電池狀態和電量百分比,我只是想獲取CycleCount的 –