Registry /
communication / pyobjc-framework-pushkit
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PKPushRegistry
✓ from PushKit import PKPushRegistry
PKPushRegistryDelegate
✓ from PushKit import PKPushRegistryDelegate
PKPushTypeVoIP
✓ from PushKit import PKPushTypeVoIP
This quickstart demonstrates how to initialize `PKPushRegistry` and register for VoIP push notifications using `pyobjc-framework-pushkit`. It defines a delegate class to handle push registration updates and incoming notifications, then starts a console event loop to process these events. This code requires a macOS environment and an application bundle that has PushKit capabilities enabled.
import objc
from Foundation import NSObject, NSLog, NSSet
from PushKit import PKPushRegistry, PKPushRegistryDelegate, PKPushTypeVoIP
from PyObjCTools import AppHelper
class PushDelegate(NSObject):
# Adopting the PKPushRegistryDelegate protocol
def init(self):
self = objc.super(PushDelegate, self).init()
if self is None:
return None
NSLog('PushDelegate initialized.')
return self
def pushRegistry_didUpdatePushCredentials_forType_(self, registry, credentials, pushType):
NSLog(f'pushRegistry:didUpdatePushCredentials:forType_ called for type: {pushType}, token: {credentials.token()}')
# In a real app, send credentials.token() to your server
# for APNs registration.
def pushRegistry_didReceiveIncomingPushWithPayload_forType_completionHandler_(self, registry, payload, pushType, completion):
NSLog(f'pushRegistry:didReceiveIncomingPushWithPayload:forType:completionHandler_ called for type: {pushType}, payload: {payload}')
# Process the incoming push notification payload.
# Call the completion handler when done.
completion()
def pushRegistry_didInvalidatePushTokenForType_error_(self, registry, pushType, error):
NSLog(f'pushRegistry:didInvalidatePushTokenForType:error_ called for type: {pushType}, error: {error}')
def main():
# Initialize an NSApplication (required for delegate pattern)
# For a console app, you might not explicitly use NSApplication.sharedApplication(),
# but the runloop expects a Cocoa environment.
# from AppKit import NSApplication # Uncomment if you need direct AppKit interaction
# Create the push registry delegate
delegate = PushDelegate.alloc().init()
# Create a PKPushRegistry object
# initWithQueue:nil means callbacks happen on the main thread
# PKPushRegistry requires a queue, typically the main queue for UI apps
# For a simple console app, we can use nil to imply the main thread's runloop.
push_registry = PKPushRegistry.alloc().initWithQueue_(None)
push_registry.setDelegate_(delegate)
# Register for VoIP push notifications
push_registry.setDesiredPushTypes_(NSSet.setWithObject_(PKPushTypeVoIP))
NSLog('PushKit registration initiated. Entering app event loop.')
# Run the application's event loop. This is crucial for receiving delegate callbacks.
# In a real app, this would be part of the main NSApplication runloop.
# For a simple console demonstration, AppHelper.runConsoleEventLoop() is used.
try:
AppHelper.runConsoleEventLoop(installInterrupt=True)
except KeyboardInterrupt:
NSLog('Application terminated by user.')
AppHelper.stopEventLoop()
if __name__ == '__main__':
main()
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredCore bridge between Python and Objective-C, required for all PyObjC framework wrappers.
pyobjc-framework-CocoaoptionalProvides fundamental Cocoa classes like NSObject and NSApplication, often implicitly required by macOS applications.