{"library":"pyobjc-framework-devicecheck","title":"PyObjC DeviceCheck Framework","description":"PyObjC-framework-DeviceCheck provides Python wrappers for Apple's DeviceCheck framework on macOS, allowing Python applications to interact with DeviceCheck APIs to manage device state and assert app integrity. It is part of the broader PyObjC project, a bridge that enables Python scripts to fully utilize Objective-C class libraries like Cocoa. The library is actively maintained, with version 12.1 being the current release, and follows a frequent release cadence tied to macOS SDK and Python version updates.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-devicecheck"],"cli":null},"imports":["from DeviceCheck import DCDevice","from PyObjCTools import AppHelper"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import objc\nfrom DeviceCheck import DCDevice\nfrom PyObjCTools import AppHelper\nimport Foundation # For NSData, NSError types\n\ndef device_check_completion_handler(token_data, error):\n    \"\"\"Objective-C completion handler for generateTokenWithCompletionHandler_.\"\"\"\n    if error:\n        print(f\"Error generating token: {error.localizedDescription()}\")\n    elif token_data:\n        # NSData object from Objective-C can be converted to Python bytes\n        python_token = token_data.bytes().tobytes()\n        print(f\"Successfully generated DeviceCheck token (first 10 bytes): {python_token[:10]}...\")\n    else:\n        print(\"No token data and no error received.\")\n    AppHelper.stopEventLoop()\n\ndef main():\n    device = DCDevice.currentDevice()\n\n    if not device.isSupported():\n        print(\"DeviceCheck is not supported on this device (e.g., simulator).\")\n        return\n\n    print(\"DeviceCheck is supported. Generating token...\")\n    # Call the asynchronous Objective-C method with a Python callable as handler\n    device.generateTokenWithCompletionHandler_(device_check_completion_handler)\n    \n    # Start the PyObjC event loop to process the asynchronous call\n    print(\"Starting event loop (waiting for token or error)...\")\n    AppHelper.runEventLoop()\n    print(\"Event loop stopped.\")\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to access the current DCDevice, check if DeviceCheck is supported, and then generate a device token using an asynchronous Objective-C method. A Python function is used as the completion handler to process the token or any errors, and the PyObjCTools.AppHelper is used to manage the event loop necessary for asynchronous Objective-C calls in a script.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.3,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-devicecheck","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":4,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}