Post

Replies

Boosts

Views

Activity

StoreKit Testing with different Country Codes
I am writing unit tests that change the country by setting the .storefront property of SKTestSession to different country codes. I have made sure that the country codes I am using are indeed valid based on ISO 3166-1 alpha-3 region code standards. My default storefront in the StoreKit Configuration file is "USA" but in the unit test, I set it to say "IND" and it runs my test. In the production code, when I print await Storefront.current?.countryCode, I indeed get "IND" as expected. Now when I change the value to say "RUS" by assigning it to the SKTestSession instance, the printed value in production code is still "IND" from the previous assignment. If I call .resetToDefaultState() on the session after first test passes with "IND", it defaults to "USA" but when I set it to "RUS" in my test after it, it stays on "USA". Basically the value does not change after the first change and calling reset resets it to configuration file default but reassigning a new value has no effect on Storefront. What am I doing wrong? Btw, I have tested with both XCTest and Swift Testing but the testing framework has nothing to do with this issue. I am on Xcode 16, macOS 15, Swift 6
3
0
331
Sep ’24
StoreKit Transaction Price values
Apple added price field on StoreKit's Transaction with Xcode 15.1 and I adopted immediately. What I saw was that when the app was run in debug or TestFlight, the values for price were the same as they were displayed to the user e.g. $29.99 would be returned as 29.99 but in production I got values multiplied by 1000. They do multiply values by 1000 for App Store Server Notifications and APIs though but it is not documented as such for StoreKit's Transaction price field. I am afraid to make this change again and deploy it to production. Has anybody experienced anything like this?
2
0
575
Jun ’24
How to retrieve prorated refunded amount on original subscription after upgrade?
Apple automatically refunds the prorated amount on the original subscription after it is upgraded. Since upgrades happen immediately and start a new billing cycle beginning from the day of upgrade, the previous original subscription is refunded for the prorated amount. Is there any way to retrieve the amount that was refunded by Apple? The transaction that was upgraded is marked with isUpgraded flag to true but the price field on it still shows the full amount and there is no App Store Server Notification that tells us how much was the refund. How do I get the refunded amount?
1
0
1k
Apr ’24
SecItemAdd fails with error -25293 (`errSecAuthFailed`) on Xcode Cloud
I am developing a macOS app with SwiftUI which adds a generic password to the keychain. I have a unit test that tests my keychain utility function (see below). The unit test that covers this function always throws the error on Xcode Cloud but works perfectly fine locally on my mac. let query = [ kSecClass: kSecClassGenericPassword, kSecAttrService: service, kSecAttrAccount: account, kSecValueData: passwordData, ] let added = SecItemAdd(insert as CFDictionary, nil) guard added == errSecSuccess else { throw error }
0
0
342
Nov ’23
Xcode build error
Xcode 11.3.1macOS Catalina 10.15.3I am getting this error when I try building appFailed to find or create execution context for description '<IBCocoaTouchPlatformToolDescription: 0x7fd283181f90> System content for IBCocoaTouchFramework-ThirteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fd283187160> scaleFactor=2x'.So far I have tried rebooting, killing CoreSimulator process, cleaning build folder, deleting derived data but nothing has helped.This error shows for SwiftUI as well as UIKit apps. I am not able to build any app on Xcode
1
0
725
Feb ’20