Issues with screen capture on OS X - CGDisplayCrea

2019-07-14 00:15发布

问题:

I am using CGDisplayCreateImage(CGMainDisplayID()) to capture screen. When we do a fast user switch to another user, it still captures screen from first user. CGMainDisplayID() on second user returns 1104977152. Any idea why this is happening?

My intention is to capture active screen. In case of mirroring, I don't mind capturing the active display.

Other than Quartz APIs, any other suggestions?