Falha na função IOMobileFramebufferGetLayerDefaultSurface no iOS 9
Criei um aplicativo para capturar imagens em segundo plano. Funciona bem no iOS 7.x e 8.x, mas não foi executado no iOS 9 beta. Aqui está o meu código:
CFMutableDictionaryRef sm = IOServiceMatching("AppleH1CLCD");
io_service_t ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
if (!ioService)
{
sm = IOServiceMatching("AppleM2CLCD");
ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
}
if (!ioService)
{
sm = IOServiceMatching("AppleCLCD");
ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
}
IOMobileFramebufferConnection connection = 0;
IOSurfaceRef ptr = nil;
IOMobileFramebufferReturn openMobileFrameBufferResult = IOMobileFramebufferOpen(ioService, mach_task_self(), 0, &connection);
if (openMobileFrameBufferResult)
{
return;
}
IOMobileFramebufferReturn getLayerDefaultSurfaceResult = IOMobileFramebufferGetLayerDefaultSurface(connection, 0, (CoreSurfaceBufferRef*)&ptr);
if (getLayerDefaultSurfaceResult)
{
return; // Here, the getLayerDefaultSurfaceResult is -536870201, not 0!
}
.......
Ao depurar passo a passo, descobri que a função IOMobileFramebufferGetLayerDefaultSurface falhou ao executar com um valor retornado -536870201 e o valor esperado era 0.
Quem pode me dizer por que isso aconteceu e como resolvê-lo? thhhhhhhhhhhhhhhx !!