Hello everyone,
I’m having trouble configuring SKTestSession
for StoreKit testing in my UI tests. Specifically, I’m encountering the ASDErrorDomain Code 505
error when trying to set the storefront and locale in my test configuration. Despite following the setup steps, I keep getting errors indicating that the storefront and locale cannot be set, and the transactions are not being processed correctly.
Here are the error messages I’m seeing:
[SKTestSession] Error saving configuration file: Error Domain=ASDErrorDomain Code=505 "(null)"
[SKTestSession] Error setting storefront to JPN for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)"
[SKTestSession] Error fetching the current storefront: Error Domain=ASDErrorDomain Code=505 "(null)"
[SKTestSession] Error setting value to ja for identifier 4 for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)"
[SKTestSession] Error fetching value for identifier 4 for com.company.product: Error Domain=ASDErrorDomain Code=505 "(null)"
These errors suggest that SKTestSession
is unable to save or apply the configuration properly, but I’m not sure why. I’ve tried various storefronts and locales, but the issue persists. I’m running this on Xcode 16.0 (16A242d) on macOS 14.7 and 15.
Below is the code for the setUpSession
function I’m using to configure the session:
func setUpSession(configuration: String = "Configuration", storefront: String? = nil, localeIdentifier: String? = nil) throws -> SKTestSession
{
var session: SKTestSession!
try XCTContext.runActivity(named: "Set up subscriptions for \"\(configuration)\" storefront: \"\(storefront ?? "")\" and locale: \"\(localeIdentifier ?? "")\"")
{
activity in
session = try SKTestSession(configurationFileNamed: configuration)
if let storefront
{
session.storefront = storefront
}
if let localeIdentifier
{
session.locale = Locale(identifier: localeIdentifier)
}
session.disableDialogs = true
let info = XCTAttachment(string: "storefront: \(session.storefront)\nlocale: \(session.locale.identifier)\ntransactions: \(session.allTransactions().count)")
info.name = "Session configuration"
activity.add(info)
XCTAssertEqual(session.storefront, storefront, "Failed to set storefront")
XCTAssertEqual(session.locale.identifier, localeIdentifier, "Failed to set locale")
}
return session
}
What I’ve Tried:
- Ensuring that storefront and locale values are valid.
- Resetting StoreKit configuration in Xcode’s scheme settings.
- Deleting derived data and restarting Xcode.
- Testing with different values for storefront and locale.
Has anyone encountered similar issues with ASDErrorDomain Code 505
, or can anyone point out what might be causing this? Any help would be greatly appreciated!
Thank you!