{"id":6117,"library":"pyobjc-framework-instantmessage","title":"PyObjC InstantMessage Framework","description":"PyObjC is a bridge between Python and Objective-C, enabling Python scripts to interact with and extend existing Objective-C class libraries, including Apple's Cocoa frameworks. The `pyobjc-framework-instantmessage` package (version 12.1) specifically provides Python bindings for the macOS InstantMessage framework. PyObjC generally coordinates its releases with macOS SDK updates, often leading to multiple major versions released per year.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","bindings","framework","apple-cocoa","deprecated"],"install":[{"cmd":"pip install pyobjc-framework-instantmessage","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This package provides bindings for a specific macOS framework and relies on the core PyObjC bridge functionality.","package":"pyobjc-core"}],"imports":[{"note":"Classes and constants from the InstantMessage framework are typically imported directly from the `InstantMessage` module.","symbol":"ABPresence","correct":"from InstantMessage import ABPresence"}],"quickstart":{"code":"import InstantMessage\nimport objc\n\ntry:\n    # The InstantMessage framework itself is deprecated by Apple and removed in macOS 14.\n    # This example primarily demonstrates successful module import and attribute access,\n    # but functionality will be limited or absent on newer macOS versions.\n    if hasattr(InstantMessage, 'ABPresence'):\n        # Accessing a historically known class/protocol from the framework\n        ABPresence = InstantMessage.ABPresence\n        print(f\"Successfully imported InstantMessage and found ABPresence: {ABPresence}\")\n        print(\"Note: The InstantMessage framework is deprecated by Apple and its functionality may be limited or absent on recent macOS versions.\")\n    else:\n        print(\"InstantMessage framework module loaded, but ABPresence class not found. \"\n              \"This is expected on macOS versions where the framework is removed (e.g., macOS 14+).\")\n\nexcept ImportError as e:\n    print(f\"Error importing InstantMessage: {e}. \"\n          \"Ensure pyobjc-framework-instantmessage is installed and compatible with your macOS version.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"Demonstrates importing the `InstantMessage` framework bindings and attempting to access a historically available class. It includes a warning about the underlying framework's deprecation by Apple."},"warnings":[{"fix":"Migrate away from the InstantMessage framework. There is no direct replacement from Apple for `IMServicePlugIn`.","message":"The `IMServicePlugIn` bindings are no longer available as the entire InstantMessage framework was deprecated in macOS 10.13 and removed in macOS 14. Any code relying on `IMServicePlugIn` will break on PyObjC versions 10.0 and later.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Avoid using the InstantMessage framework for new development. Consult Apple's documentation for alternative communication technologies if available, though the specific Instant Messaging capabilities may no longer be supported.","message":"The underlying Apple InstantMessage framework is deprecated and has been removed in macOS 14 (Sonoma). While `pyobjc-framework-instantmessage` bindings exist, the functionality they expose will be non-existent on modern macOS versions.","severity":"deprecated","affected_versions":"All versions on macOS >= 14"},{"fix":"Upgrade to Python 3.10 or newer.","message":"Support for Python 3.9 was dropped in PyObjC 12.0.","severity":"breaking","affected_versions":">=12.0"},{"fix":"Upgrade to Python 3.9 or newer (Python 3.10+ recommended for current PyObjC versions).","message":"Support for Python 3.8 was dropped in PyObjC 11.0.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review PyObjC documentation on class instantiation and subclassing. Ensure `__init__` is only used when a custom `__new__` is also implemented, or follow PyObjC's recommended patterns for object initialization.","message":"Changes in `__init__` and `__new__` behavior when subclassing Objective-C classes in Python can lead to unexpected initialization issues. Specifically, if a user implements `__new__`, `__init__` can be used; otherwise, `__init__` cannot be used with the PyObjC-provided `__new__`.","severity":"gotcha","affected_versions":">=10.3"},{"fix":"Review code that interacts with Objective-C initializer methods for potential reference counting mismatches, especially if performing manual memory management or interacting with 'partially initialized' objects.","message":"PyObjC 11.1 introduced changes in how initializer methods (methods in the 'init' family) handle reference counts, aligning with `clang`'s Automatic Reference Counting documentation. Initiator methods now correctly steal a reference to `self` and return a new reference, which might affect manual reference counting logic in older PyObjC code.","severity":"gotcha","affected_versions":">=11.1"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}