What's new in StoreKit testing

RSS for tag

Discuss the WWDC22 Session What's new in StoreKit testing

Posts under wwdc2022-10039 tag

2 Posts
Sort by:
Post not yet marked as solved
1 Replies
203 Views
We are trying to integrate StoreKit Testing into our unit and UI testing flow on Mac and iOS. The basic idea is bypassing the paywall so that the specific test can do its job without interference. In our subclass of XCUIApplication, we've overridden the launch method to simulate the purchase of the app's full version: import XCTest import StoreKitTest class OurCustomApp : XCUIApplication { private var _storeKitSession : AnyObject? = nil override func launch() { super.launch() do { _storeKitSession = try SKTestSession(configurationFileNamed: "iap_desktop") (_storeKitSession as! SKTestSession).disableDialogs = true (_storeKitSession as! SKTestSession).clearTransactions() try (_storeKitSession as! SKTestSession).buyProduct(productIdentifier: "<our product identifier>") } catch { XCTFail("Can't setup StoreKit test. \(error)") } } } However, we faced a weird runtime issue: UITests-Runner[53387:25779369] Error in XPC connection when checking Xcode Test app: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.storekitagent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.storekitagent was invalidated: failed at lookup with error 159 - Sandbox restriction.} We use the proper certificate for StoreKit Testing and follow all the steps from Setting Up StoreKit Testing in Xcode. The problem reproduces on all our machines, including Intel-based and M1 Macs. We'd appreciate any hints or clues that will help us resolve this issue.
Posted
by eyen.
Last updated
.