How to enable IOSurfaceRef
I am trying to build an application using private APIs to take screenshots from the background. I found this example: Taking Screenshots in the Background (iOS) - Improving Performance
In the author's code, the first line uses the IOSurfaceRef type. Can anyone explain to me how to include this in my code? I tried linking IOSurfaceAPI.h (where I defined IOSurfaceRef), however it didn't work.
source to share
First, let's start with how to link Frameworks
-
go to https://github.com/kennytm/iphone-private-frameworks/tree/master/IOSurface and download the headers
-
the IOSurfaceAPI.h files are not included in the link link "for legal reasons" and you must copy it from Xcode here
change MacOSX10.11.sdk in path to match sdk included in Xcode
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ MacOSX10.11.sdk /System/Library/Frameworks/IOSurface.framework/Versions/A/Headers
- go to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/PrivateFrameworks/IOSurface.framework and create a folder called Headers
replace iPhoneOS.platform with iPhoneSimulator.platform , paste the headers into the simulator SDK folder if you want to try apps on the simulator
- insert all files inside
You can now use the IOSurface Framework
source to share