pyobjc-framework-replaykit provides Python bindings for Apple's ReplayKit framework on macOS, enabling developers to integrate screen recording and broadcasting capabilities into their Python applications. Part of the larger PyObjC project, it closely tracks macOS SDK updates, with current version 12.1. The PyObjC project generally releases new versions multiple times a year, often aligning with major macOS releases and Python version updates.
pip install pyobjc-framework-replaykitVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to check if ReplayKit is available for screen recording on the current macOS system. It sets up a minimal `PyObjCTools.AppHelper` event loop, which is often required for PyObjC applications interacting with Cocoa frameworks on the main thread. The `applicationDidFinishLaunching_` method, analogous to `AppDelegate` in Objective-C, is used to interact with the `ReplayKit.RPScreenRecorder` shared instance.
Upgrade your Python interpreter to version 3.10 or later, or use an older PyObjC version (e.g., PyObjC 10.x for Python 3.9, PyObjC 9.x for Python 3.8).
Review custom initializer methods in your Python classes exposed to Objective-C to ensure correct reference handling, especially if you manually managed `objc_object` reference counts or observed unexpected object lifetimes.
If encountering issues with `__init__` not being called, ensure that if your class is an `NSObject` subclass, `__init__` is not called on an instance that was implicitly created via PyObjC's `__new__` mechanism. Consider moving initialization logic to Objective-C style initializer methods (e.g., `initWithSomething_`).