{"id":6181,"library":"pyobjc-framework-storekit","title":"PyObjC StoreKit Framework","description":"PyObjC is a bridge between Python and Objective-C, allowing Python scripts to use and extend macOS frameworks. `pyobjc-framework-storekit` provides Python wrappers for Apple's StoreKit framework, enabling developers to integrate in-app purchases and subscriptions into macOS applications written in Python. The current version is 12.1, and the project maintains an active release cadence, frequently updating bindings for new macOS SDKs and Python versions.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["python","macOS","Objective-C","StoreKit","Cocoa","framework","in-app-purchase"],"install":[{"cmd":"pip install pyobjc-framework-storekit","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"The core PyObjC bridge is required for all framework wrappers.","package":"pyobjc-core","optional":false}],"imports":[{"note":"All classes, constants, and functions from the StoreKit framework are available after importing `StoreKit`.","symbol":"StoreKit","correct":"import StoreKit"}],"quickstart":{"code":"import objc\nfrom Foundation import NSObject\nfrom StoreKit import SKPaymentQueue\nfrom PyObjCTools import AppHelper\n\nclass StoreKitDelegate(NSObject):\n    def paymentQueue_updatedTransactions_(self, queue, transactions):\n        for transaction in transactions:\n            print(f\"Transaction State: {transaction.transactionState}, Product ID: {transaction.payment.productIdentifier}\")\n\n    # Other delegate methods would go here, e.g., for purchase failures, restores, etc.\n\ndef main():\n    print(\"Initializing StoreKit components...\")\n    # Obtain the default payment queue\n    queue = SKPaymentQueue.defaultQueue()\n\n    # Create and set a delegate (critical for handling transaction updates)\n    delegate = StoreKitDelegate.alloc().init()\n    queue.addTransactionObserver_(delegate)\n\n    print(\"StoreKit observation started. This requires a running Cocoa event loop.\")\n    print(\"To actually initiate purchases, you would call queue.addPayment_(SKPayment.paymentWithProduct_)\")\n    print(\"Note: Full StoreKit functionality requires an application signed by Apple and distributed via the Mac App Store.\")\n    # In a real app, AppHelper.runEventLoop() would be called, typically after setting up the GUI\n    # AppHelper.runEventLoop() \n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to import the `StoreKit` framework and begin observing payment queue transactions. Note that a fully functional StoreKit implementation requires a running macOS Cocoa application context, proper provisioning profiles, and an application distributed through the Mac App Store. The `AppHelper.runEventLoop()` call, commented out here, is essential for a complete PyObjC GUI application to process events."},"warnings":[{"fix":"Upgrade to Python 3.10 or newer, or use an older `pyobjc-framework-storekit` version compatible with your Python environment.","message":"PyObjC version 12.0 dropped support for Python 3.9, and version 11.0 dropped support for Python 3.8. Ensure your project uses Python 3.10 or later for `pyobjc-framework-storekit` 12.x.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review any manual reference counting logic, especially around `init` methods, to ensure it's compatible with ARC semantics.","message":"Starting with PyObjC 11.1, the core bridge's behavior for Objective-C initializer methods aligns with `clang`'s Automatic Reference Counting (ARC) documentation. Methods in the 'init' family now correctly steal a reference to `self` and return a new reference. This might affect custom memory management patterns or interactions with C/Objective-C code directly.","severity":"breaking","affected_versions":">=11.1"},{"fix":"Ensure your development environment and application distribution plan comply with Apple's requirements for StoreKit usage. Testing often involves Xcode's StoreKit Configuration files.","message":"The StoreKit framework is primarily designed for applications distributed through the Mac App Store and requires code signing by Apple. Developing with StoreKit outside of this context (e.g., for standalone scripts or non-App Store distribution) is severely limited or impossible.","severity":"gotcha","affected_versions":"all"},{"fix":"For classes with user-defined `__new__`, ensure `__init__` is called explicitly if needed. For classes relying on PyObjC's default `__new__`, avoid implementing `__init__` or refactor the initialization logic.","message":"PyObjC 10.3 initially removed support for calling `__init__` when a user-defined `__new__` was present, breaking some projects. Version 10.3.1 reintroduced the ability to use `__init__` in such cases, but only if the class or a superclass explicitly implements `__new__`. If you rely on PyObjC's default `__new__`, `__init__` cannot be used.","severity":"gotcha","affected_versions":"10.3"},{"fix":"If targeting Python 3.13 with free-threading, test thoroughly and be aware that behavior might be experimental or not fully stable. Consider using standard Python threading if issues arise.","message":"Experimental support for Python 3.13's free-threading (PEP 703) was introduced in PyObjC 11.0. However, PyObjC 10.3 explicitly stated it did not support free-threading. While there's experimental support, caution is advised, and stability with free-threading may still be evolving.","severity":"gotcha","affected_versions":">=10.3"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}