iOS 9上的IOMobileFramebufferGetLayerDefaultSurface函数失败 [英] IOMobileFramebufferGetLayerDefaultSurface function failed on iOS 9

查看:569
本文介绍了iOS 9上的IOMobileFramebufferGetLayerDefaultSurface函数失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个应用程序来捕捉后台截图。它适用于iOS 7.x& 8.x,但无法在iOS 9测试版上执行。这是我的代码:

I created a app to capture screenshot in background. It works well on iOS 7.x & 8.x, but failed to execute on iOS 9 beta. Here's my code:

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!
}

.......

当逐步调试时,我发现IOMobileFramebufferGetLayerDefaultSurface函数无法以返回值-536870201执行,预期值为0.

When debugging it step by step, I found that the function IOMobileFramebufferGetLayerDefaultSurface failed to execute with a returning value -536870201 and the value expected was 0.

谁能告诉我为什么会这样,以及如何解决? thhhhhhhhhhhhhhhx !!

Who can tell me why this happened and how to resolve it ? thhhhhhhhhhhhhhhx!!

推荐答案

另一位用户问过类似的问题。我在iOS8和iOS9(GM)上进行了一些挖掘 IOMobileFramebufferGetLayerDefaultSurface 。我发现的结果总结在此答案中。

Another user asked a similar question. I did some digging into IOMobileFramebufferGetLayerDefaultSurface on iOS8 vs iOS9 (GM). And the results of what I found are summarized in this answer.

鉴于这些结果,我相信从iOS9开始,不再可能使用IOMFB捕获屏幕。

Given these results, I believe it is no longer possible, as of iOS9, to use IOMFB to capture the screen.

这篇关于iOS 9上的IOMobileFramebufferGetLayerDefaultSurface函数失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆