{"id":6114,"library":"pyobjc-framework-imagecapturecore","title":"PyObjC ImageCaptureCore Framework Bindings","description":"This library provides Python bindings for Apple's ImageCaptureCore.framework, enabling Python applications to interact with scanners, cameras, and other image capture devices on macOS. It is part of the larger PyObjC project, which wraps various macOS frameworks. The current version is 12.1, with releases tightly coupled to macOS SDK updates and Python version support.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macOS","Objective-C","Cocoa","framework","binding","ImageCaptureCore","scanner","camera"],"install":[{"cmd":"pip install pyobjc-framework-imagecapturecore","lang":"bash","label":"Install only ImageCaptureCore bindings"},{"cmd":"pip install pyobjc","lang":"bash","label":"Install all PyObjC frameworks (including ImageCaptureCore)"}],"dependencies":[{"reason":"The fundamental bridge for Objective-C, required by all PyObjC framework bindings.","package":"pyobjc-core","optional":false},{"reason":"Needed for `PyObjCTools.AppHelper` to run Cocoa event loops, which are common for handling asynchronous ImageCaptureCore operations.","package":"pyobjc-framework-AppKit","optional":true},{"reason":"A metapackage that installs `pyobjc-core` and all framework bindings (including ImageCaptureCore).","package":"pyobjc","optional":true}],"imports":[{"note":"The framework's classes are typically accessed as attributes of the imported module, e.g., `ImageCaptureCore.ICDeviceBrowser`.","symbol":"ImageCaptureCore","correct":"import ImageCaptureCore"},{"symbol":"ICDeviceBrowser","correct":"from ImageCaptureCore import ICDeviceBrowser"}],"quickstart":{"code":"import ImageCaptureCore\nimport objc\nfrom PyObjCTools import AppHelper\n\nclass MyDeviceBrowserDelegate(objc.NSObject):\n    def deviceBrowser_didAddDevice_moreComing_(self, browser, device, moreComing):\n        print(f\"[*] Found device: {device.name()} (UUID: {device.uuid()})\")\n        # You can access device properties here, e.g., device.type(), device.icon().\n\n    def deviceBrowser_didRemoveDevice_moreComing_(self, browser, device, moreComing):\n        print(f\"[-] Removed device: {device.name()} (UUID: {device.uuid()})\")\n\ndef main():\n    browser = ImageCaptureCore.ICDeviceBrowser.alloc().init()\n    delegate = MyDeviceBrowserDelegate.alloc().init()\n    browser.setDelegate_(delegate)\n    \n    print(\"Starting ImageCaptureCore device browser. Press Ctrl+C to exit.\")\n    print(\"Detected devices will be printed as they are found or removed.\")\n    \n    browser.start()\n    # Run the Cocoa event loop indefinitely to receive delegate callbacks.\n    # This keeps the script alive and responsive to system events.\n    AppHelper.runConsoleEventLoop(installInterrupt=True)\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to use `ICDeviceBrowser` to discover image capture devices on macOS. It sets up a delegate to receive callbacks for device additions and removals and runs a console event loop to keep the application responsive. Note that `PyObjCTools.AppHelper` requires `pyobjc-framework-AppKit` to be installed."},"warnings":[{"fix":"Ensure your Python environment is version 3.10 or newer. Always check the `requires_python` metadata for the PyObjC version you intend to use.","message":"PyObjC versions are tightly coupled with supported Python versions. PyObjC 12.0 dropped support for Python 3.9, requiring Python 3.10 or newer. PyObjC 11.0 dropped support for Python 3.8.","severity":"breaking","affected_versions":"<12.0 (for Python 3.9), <11.0 (for Python 3.8)"},{"fix":"Run PyObjC applications exclusively on macOS platforms.","message":"PyObjC framework bindings are macOS-specific. Attempting to import or use `pyobjc-framework-imagecapturecore` on non-macOS operating systems will result in import errors or runtime failures.","severity":"gotcha","affected_versions":"All"},{"fix":"Integrate your ImageCaptureCore interactions within a running Cocoa event loop. For simple console scripts, `AppHelper.runConsoleEventLoop()` is the idiomatic way.","message":"Many ImageCaptureCore operations are asynchronous and rely on delegate callbacks. To receive these callbacks and keep your application responsive, you must run a Cocoa event loop (e.g., using `PyObjCTools.AppHelper.runConsoleEventLoop()` for console apps or within a GUI application's main loop).","severity":"gotcha","affected_versions":"All"},{"fix":"Carefully review the PyObjC documentation on subclassing Objective-C classes in Python, especially regarding `__new__` and `init` methods, to ensure correct object initialization and avoid uninitialized objects.","message":"When subclassing Objective-C classes in Python with PyObjC, the interaction between `__new__` and `__init__` can be nuanced. If your Python subclass (or one of its superclasses) explicitly defines `__new__`, then `__init__` will be called. However, if `__new__` is *not* explicitly overridden by the user, `__init__` will *not* be called. This can lead to objects not being initialized as expected.","severity":"gotcha","affected_versions":"10.3.0 and >=10.3.1"},{"fix":"If you have complex Python subclasses that override Objective-C `init` methods, review their reference counting behavior to ensure it aligns with ARC semantics after the PyObjC 11.1 update.","message":"PyObjC 11.1 introduced a change in how it models initializer methods to align with Clang's Automatic Reference Counting (ARC). Methods in the 'init' family (e.g., `init` methods) now correctly 'steal' the reference to `self` and return a new reference. This change can affect complex object graphs or manual reference counting scenarios in Python subclasses.","severity":"gotcha","affected_versions":"11.1 and later"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}