IOMobileFramebufferGetLayerDefaultSurface函数在iOS 9上失败
我创建了一个应用程序来捕获背景中的屏幕截图。它在iOS 7.x和8.x上运行良好,但在iOS 9测试版上无法执行。这是我的密码:IOMobileFramebufferGetLayerDefaultSurface函数在iOS 9上失败,ios,objective-c,screen-capture,Ios,Objective C,Screen Capture,我创建了一个应用程序来捕获背景中的屏幕截图。它在iOS 7.x和8.x上运行良好,但在iOS 9测试版上无法执行。这是我的密码: CFMutableDictionaryRef sm = IOServiceMatching("AppleH1CLCD"); io_service_t ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm); if (!ioService) { sm = IOServiceMatchin
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
谁能告诉我为什么会发生这种情况以及如何解决?哈哈哈哈哈 另一个用户问了类似的问题。我在iOS8和iOS9(GM)上深入研究了
IOMobileFramebufferGetLayerDefaultSurface
。我发现的结果总结在
鉴于这些结果,我认为从iOS9开始,使用IOMFB捕捉屏幕已不再可能。另一位用户提出了类似的问题。我在iOS8和iOS9(GM)上深入研究了
IOMobileFramebufferGetLayerDefaultSurface
。我发现的结果总结在
鉴于这些结果,我认为从iOS9开始,使用IOMFB捕捉屏幕已不再可能。您查找过该错误代码吗?该函数来自一个私有框架,我无法获得有关它的任何错误代码描述-(你查过那个错误代码了吗?这个函数来自一个私有框架,我无法得到关于它的任何错误代码描述……:-(