Post

Replies

Boosts

Views

Activity

Help with SKTestSession Setup - ASDErrorDomain Code 505 Error
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!
0
3
429
Oct ’24
Sign In With Apple Button stretches to occupy entire window
Hi all! When building with macOS 14 SDK in macOS 14 RC, the Sign In With Apple button(SignInWithAppleButton) stretches its background to occupy the entire window content view. We expect it to be in the area with a red stroke(see the screenshot) Here's the code: struct ContentView: View { var body: some View { SignInWithAppleButton(.signIn, onRequest: { $0.requestedScopes = [.fullName, .email] }, onCompletion: { _ in }) .signInWithAppleButtonStyle(.black) .border(Color.red, width: 3) .padding(80) } } And screenshot: One important addition: the button works, and its hit area remains within that red rectangle. Any help is highly appreciated. Thank you!
5
1
1.2k
Sep ’23
Weird Swift concurrency warnings when building Swift project with Xcode 14.3
When building our project in Xcode 14.3, numerous weird warnings do not seem to be related to our code: <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.FoundationAttributes, AttributeScopes.FoundationAttributes.DateFieldAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.UIKitAttributes, AttributeScopes.UIKitAttributes.FontAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.UIKitAttributes, AttributeScopes.UIKitAttributes.FontAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ It is just a tiny portion of warnings we wee in build results each time. Hundreds of them make it impossible to spot other warnings that these logs might obscure. We can't figure out where they come from, what triggers them, and, more importantly, how to eliminate or at least suppress them. Can anyone suggest any workaround or give a clue on how to fix these warnings?
7
3
2.2k
Jun ’23
UIViewRepresentable and safe area insets.
Hi everyone! We struggle to get the safe area insets from SwiftUI context into our custom UIScrollView subclass. It has to go under the custom top navigation bar and bottom toolbars. In SwiftUI, our code looks like the following: struct ContentView: View { var body: some View { CustomScrollView() .ignoresSafeArea() // Spread it out from top to bottom .safeAreaInset(edge: .top) // Add custom nav bar at top { CustomNavigationBar() } .safeAreaInset(edge: .bottom) // Add custom toolbar at bottom { CustomToolbar() } } } The layout looks fine, except that CustomScrollView, which is a UIScrollView subclass, does not inherit the proper safeAreaInsets from SwiftUI. We tried to examine every value reachable in Context from updateUIView(_, context:) within our UIViewRepresentable, but no luck. Are we missing something here? Should a UIScrollView subclass inherit safe area insets automatically, or should we explicitly get them from GeometryReader? We appreciate any clues or suggestions that will help us solve this problem. Thank you!
1
4
1.6k
Aug ’22
Strange runtime error when using StoreKit Test API
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.
1
0
1.5k
Jun ’22
@Invalidating property wrapper availability
Hi all! I'm very excited about the new @Invalidating property wrapper introduced in the "What's new in AppKit" session. However, after installing Xcode 13 and using it in my code, I get a compiler error saying "Unknown attribute 'Invalidating'" Also, I can't find anything in the documentation about the property wrapper in question or the NSViewInvalidating protocol it relies on. Is it available yet, or is it restricted to macOS 12 only? Thank you!
2
0
1.4k
Jun ’21
StoreKit testing for non-debug configurations.
In our project, we have Debug, Release, and Profile configurations. We use Profile configuration for testing. It inherits from the Release configuration but with debug symbols, few more features for profiling(as the name implies), and some UI tweaks. The problem is that SKTestSession does not do anything in a non-debug configuration. If we run tests under Debug configuration, everything works as expected, but when we switch back to Profile, StoreKit testing doesn't work. Is there any specific build setting(s) to get StoreKit testing work for non-debug configurations?
0
0
973
Apr ’21