PyObjC Framework CallKit
PyObjC Framework CallKit provides Python wrappers for Apple's CallKit framework on macOS. It allows Python applications to interact with the system's call services, manage incoming and outgoing calls, and integrate with VoIP functionality. PyObjC frameworks typically follow the release cadence of macOS SDK updates, with frequent minor and patch releases to support new features and address compatibility.
Warnings
- breaking PyObjC 12.0 dropped support for Python 3.9. Ensure your Python environment is 3.10 or newer to use this version of the library.
- breaking PyObjC 11.0 dropped support for Python 3.8. Users on PyObjC 11.x and later must use Python 3.9 or newer.
- breaking PyObjC 10.3 introduced a change where `__init__` could not be used when the class used the PyObjC-provided `__new__` (i.e., didn't define its own `__new__`). This was partially reverted in 10.3.1 but could still affect code on 10.3.0.
- gotcha PyObjC 11.1 aligned the core bridge's Automatic Reference Counting (ARC) behavior for 'init' family methods (e.g., `alloc().init()`) to correctly model that they steal a reference to self and return a new one. This change in memory management semantics could affect existing code that relies on previous PyObjC behavior around initializers.
- gotcha PyObjC, including `pyobjc-framework-callkit`, is a macOS-specific library. These bindings will only function on macOS operating systems and require the relevant macOS SDK (typically installed via Xcode Command Line Tools).
Install
-
pip install pyobjc-framework-callkit
Imports
- *
from CallKit import *
- CXCallController
from CallKit import CXCallController
Quickstart
import objc
from CallKit import CXCallController
# Instantiate a CallKit controller.
# This action itself is valid, but for a CXCallController to be fully functional
# and interact with the system, it must be part of a running macOS application
# with appropriate CallKit entitlements.
controller = CXCallController.alloc().init()
print(f"Created CallKit controller instance: {controller}")
print(f"Class name: {controller.__class__.__name__}")
# In a real application, you would use this controller to create and request
# `CXTransaction` objects containing actions like `CXStartCallAction` or `CXEndCallAction`.
# Example of how you might start a call (requires full app context and entitlements):
# import uuid
# from CallKit import CXTransaction, CXStartCallAction, CXHandle
#
# handle = CXHandle.alloc().initWithType_value_(0, "123-456-7890") # CXHandleTypePhoneNumber = 0
# call_uuid = objc.pyobjc_id(uuid.uuid4())
# start_action = CXStartCallAction.alloc().initWithCallUUID_handle_(call_uuid, handle)
# start_action.setOutgoing_connectionAddress_hasOutgoingProvider_ttyType_(
# True, None, True, 0 # CXTTYTypeNone = 0
# )
# transaction = CXTransaction.alloc().initWithActions_([start_action])
# # controller.requestTransaction_completion_(transaction, lambda error: ...)