{"id":6095,"library":"pyobjc-framework-devicediscoveryextension","title":"PyObjC DeviceDiscoveryExtension","description":"PyObjC is a bridge between Python and Objective-C, enabling Python scripts to use and extend existing Objective-C class libraries, most notably Apple's Cocoa frameworks on macOS. This specific package provides Python wrappers for the DeviceDiscoveryExtension framework. It is currently at version 12.1 and is actively maintained as part of the broader PyObjC project, which typically sees releases monthly or bi-monthly, with framework updates following macOS SDK releases.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macOS","objective-c","cocoa","bindings","framework"],"install":[{"cmd":"pip install pyobjc-framework-devicediscoveryextension","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required as the core bridge between Python and Objective-C, providing fundamental types and functionality for all PyObjC framework wrappers.","package":"pyobjc-core","optional":false}],"imports":[{"note":"Frameworks are typically imported directly by their name, which provides access to their classes, functions, and constants.","symbol":"DeviceDiscoveryExtension","correct":"import DeviceDiscoveryExtension"}],"quickstart":{"code":"import Foundation\n\n# PyObjC allows you to interact with macOS frameworks.\n# This example uses Foundation, a core Cocoa framework.\n# For DeviceDiscoveryExtension, the import pattern is similar.\n\n# Most Cocoa objects use a two-phase initialization: allocation followed by initialization.\nmy_object = Foundation.NSObject.alloc().init()\n\nprint(f\"Successfully created a Foundation.NSObject: {my_object}\")\nprint(f\"Class name of the object: {my_object.className()}\")\n\n# To use DeviceDiscoveryExtension, you would follow a similar pattern:\n# import DeviceDiscoveryExtension\n# from DeviceDiscoveryExtension import DDEDiscoverySession\n# session = DDEDiscoverySession.alloc().init() # Example for a potential class within the framework\n# print(f\"DeviceDiscoveryExtension session created (conceptual): {session}\")","lang":"python","description":"This quickstart demonstrates the basic PyObjC pattern for importing and interacting with a macOS framework using `Foundation`. The same import and object instantiation principles apply to `DeviceDiscoveryExtension`. Note that direct usage of `DeviceDiscoveryExtension` requires specific macOS versions (macOS 15+) and an understanding of its API as per Apple's documentation."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or later, or pin `pyobjc` and its framework wrappers to a version less than 12.0 (e.g., `<12.0`).","message":"Python 3.9 support was dropped in PyObjC 12.0. Projects using PyObjC 12.0 or later (including `pyobjc-framework-devicediscoveryextension` 12.x) must use Python 3.10 or newer.","severity":"breaking","affected_versions":">=12.0"},{"fix":"Upgrade your Python environment to 3.9 or later, or pin `pyobjc` and its framework wrappers to a version less than 11.0 (e.g., `<11.0`).","message":"Python 3.8 support was dropped in PyObjC 11.0. Projects using PyObjC 11.0 or later must use Python 3.9 or newer.","severity":"breaking","affected_versions":">=11.0, <12.0"},{"fix":"Review and update code involving custom Objective-C initializer methods or subclasses to ensure correct reference management according to ARC principles. Refer to PyObjC 11.1 changelog and `clang` ARC documentation.","message":"PyObjC 11.1 introduced significant changes to how automatic reference counting (ARC) is modeled, specifically for Objective-C initializer methods (those in the 'init' family). This aligns PyObjC with `clang`'s documentation, where these methods now 'steal' a reference to `self` and return a new one. Code relying on previous reference counting behavior for initializers may break.","severity":"breaking","affected_versions":">=11.1"},{"fix":"Ensure your macOS version is compatible with the `DeviceDiscoveryExtension` framework (macOS 15 or newer). When building from source, use an Xcode/Command Line Tools version with an SDK that matches or is newer than your target deployment macOS version. For binary wheels, ensure the wheel's metadata indicates compatibility with your macOS version.","message":"PyObjC framework wrappers are tightly coupled to macOS SDK versions. The `DeviceDiscoveryExtension` framework itself was introduced in macOS 15. Using a `pyobjc-framework-devicediscoveryextension` version compiled with a newer SDK on an older macOS version (especially below macOS 15) can lead to runtime errors due to missing symbols or API incompatibility.","severity":"gotcha","affected_versions":"all"},{"fix":"If subclassing Objective-C classes, always adhere to PyObjC's two-phase instantiation (alloc then init) and ensure custom `__new__` or `__init__` methods correctly call the superclass's designated initializer. Avoid overriding `__init__` directly if relying on PyObjC's default `__new__` for Objective-C classes.","message":"PyObjC 10.3 changed the interaction between user-defined `__init__` and `__new__` methods in Python subclasses of Objective-C classes. While 10.3.1 partially reverted this, if PyObjC provides the `__new__` implementation (e.g., for default object creation), a user-defined `__init__` *still cannot be used* without carefully understanding PyObjC's two-phase instantiation model.","severity":"gotcha","affected_versions":">=10.3, <10.3.2"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}