PyObjC InstantMessage Framework

12.1 · active · verified Tue Apr 14

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.

Warnings

Install

Imports

Quickstart

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.

import InstantMessage
import objc

try:
    # The InstantMessage framework itself is deprecated by Apple and removed in macOS 14.
    # This example primarily demonstrates successful module import and attribute access,
    # but functionality will be limited or absent on newer macOS versions.
    if hasattr(InstantMessage, 'ABPresence'):
        # Accessing a historically known class/protocol from the framework
        ABPresence = InstantMessage.ABPresence
        print(f"Successfully imported InstantMessage and found ABPresence: {ABPresence}")
        print("Note: The InstantMessage framework is deprecated by Apple and its functionality may be limited or absent on recent macOS versions.")
    else:
        print("InstantMessage framework module loaded, but ABPresence class not found. "
              "This is expected on macOS versions where the framework is removed (e.g., macOS 14+).")

except ImportError as e:
    print(f"Error importing InstantMessage: {e}. "
          "Ensure pyobjc-framework-instantmessage is installed and compatible with your macOS version.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →