Hello everyone! I've encountered an issue related to SwiftUI and StoreKit. Please take a look at the SwiftUI code snippet below:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationStack {
List {
NavigationLink {
Page1()
} label: {
Text("Go to Page 1")
}
}
}
}
}
struct Page1: View {
@Environment(\.dismiss) private var dismiss
@State private var string: String = ""
var body: some View {
List {
NavigationLink {
List {
Page2(string: $string)
.simpleValue(4)
}
} label: {
Text("Tap this button will freeze the app")
}
}
.navigationTitle("Page 1")
}
}
struct Page2: View {
@Binding var string: String?
init(string: Binding<String>) {
self._string = Binding(string)
}
var body: some View {
Text("Page 2")
}
}
extension EnvironmentValues {
@Entry var simpleValue: Int = 3
}
extension View {
func simpleValue(_ value: Int) -> some View {
self.environment(\.simpleValue, value)
}
}
This view runs normally until the following symbol is referenced anywhere in the project:
import StoreKit
extension View {
func notEvenUsed() -> some View {
self.manageSubscriptionsSheet(isPresented: .constant(false))
}
}
It seems that once the project links the View.manageSubscriptionsSheet(isPresented:) method, regardless of whether it's actually used, it causes the above SwiftUI view to freeze.
Steps to Reproduce:
Clone the repository: https://github.com/gongzhang/StrangeFreeze
Open it in Xcode 16 and run on iOS 17-18.1
Navigate to the second page and tap the button, causing the app to freeze.
Remove manageSubscriptionsSheet(...), then everything will work fine
StoreKit
RSS for tagSupport in-app purchases and interactions with the App Store using StoreKit.
Posts under StoreKit tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I'm on an Intel-based Mac running macOS Sonoma 14.7.1 (23H222) and Xcode Version 16.1 (16B40).
I've created a local StoreKit Configuration File that does not synchronise with App Store Connect and selected it in the Scheme.
I have some products that are consumable in-app purchase and it loads fine as expected when I run the app and I am able to make transactions. It also show up in the Transaction Manager.
After a little while, working on the app, re-running it several times, it stops working. The products do not load the metadata from the StoreKit configuration file.
I also get this error in the console:
Error enumerating unfinished transactions for first transaction listener: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={AMSStatusCode=0, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DF5E86B0-0E4A-4982-AF42-FC58FA858C01>.<1>, NSErrorFailingURLKey=http://localhost:51027/inApps/history?guid=F01898465023&reason=initial, _kCFStreamErrorDomainKey=10, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <DF5E86B0-0E4A-4982-AF42-FC58FA858C01>.<1>"
), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=http://localhost:51027/inApps/history?guid=F01898465023&reason=initial, NSUnderlyingError=0x60000038c150 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorDomainKey=10, _kCFStreamErrorCodeKey=-72000, _NSURLErrorNWPathKey_desc=satisfied (Path is satisfied), interface: lo0, _NSURLErrorNWResolutionReportKey_desc=Resolved 0 endpoints in 0ms using unknown from query}}, _kCFStreamErrorCodeKey=-72000}
Restarting the computer resolves the issue but I don't want to restart the computer every single time when it happens and it happens quite soon after a short while.
How can I make sure that it doesn't happen or if it does happen then fix the issue without restarting the computer?
Relaunching Xcode doesn't help and neither does deleting Project Build Data and Indexes.
I have a question with isEligibleForIntroOffer(for: groupId) that in which case that isEligibleForIntroOfferForGroupId changes from false to true. I found that a few user of our app isEligibleForIntroOffer changes. they used to buy a renewing-subscription with 3-day free trial. but 3 days later. i got from logs their isEligibleForIntroOffer becomes true. We rely on this field to determine whether to display products with free trials. there is only one product with free trial introductory offer.
I encounter a problem that duplicate charges for a single purchase. iI received two transactions with the same appAccountToken but different original transactionId.(a non-renewing subscription product). One of them is from Transaction.updates. The user of our app has already given us feedback twice. the phone runs iOS 18.0.1.
I would like to know whether and how people are getting the sandbox account > manage > clear purchase history feature to work. I clear purchase history (either on my device or at app store connect), and I delete my app from my device. I then run my app from Xcode on my device, and it detects at launch the existence of the purchase, and so I cannot test my purchase user interface. Does this thing actually work as advertised?
How can I check the orders from my app's users? Sometimes users may encounter issues with their payments, so I need to verify the transactions when there are problems reported by my app's users.
Not using beginRefundRequest like method from client side code,
Can I ask apple to refund specific order from website or help center?
If it possible where is the ask to refund menu in appstore connect or other?
Third-party analytics SDKs, such as Firebase, can collect and analyze in-app purchase data without requiring explicit coding by developers. How do they achieve this? Does Apple provide a mechanism to monitor in-app purchases, or do these SDKs implement runtime monitoring of the system’s in-app purchase process themselves?
Additionally, I noticed that when using StoreKit 2 for in-app purchases, Firebase require developers to explicitly write code to enable the collection of in-app purchase data. Is this because the StoreKit 2 framework no longer supports arbitrary services implementing runtime monitoring of in-app purchases?
Hey team, we are having some unexpected transactions being sent to us by the Store Kit service. Right after we process a transaction, another transaction, with a different id, is received on paymentQueue(_:updatedTransactions:) without the user interaction.
This is breaking some of our internal flows and there were some reports of users being charged twice. I'm trying to understand where did these transactions came from and how can we avoid that. Can you help me?
I've attached some transactions that had this issue:
match_incomplete_purchases.csv
We have a user that's shared screenshots indicating that they're the recipient of a subscription to our app through Family Sharing, but when we look for the transaction in Transaction.currentEntitlements there's nothing there, even after calling AppStore.sync. Should we expect to see a transaction in current entitlements? How can we determine whether it's our bug or Apple's?
I'm currently in the process of submitting a new app with a single non-consumable In-App Purchase.
After creating the IAP in AppStore Connect, I created a synced StoreKit config in Xcode which correctly loaded the purchase.
After making sure that the transaction works as expected within the app, I submitted the app in AppStore connect, including the In-App Purchase.
Since then, the In-App Purchase can not be found in the StoreKit configuration and isn't displayed in the app, which lead to the submission being rejected.
As requested by the review team, I have resubmitted the In-App Purchase, so it's currently "Waiting for Review" but still not showing up in the StoreKit configuration in Xcode.
I'm not quite sure what I'm doing wrong here. I have other apps live in the AppStore with IAPs and no outstanding agreements to sign.
I'm testing auto renewable subscription, specifically using Xcode testing (not sandbox). It seems that subscriptions are automatically cancelled after some time. I haven't found any documentation on how long time this is, so does anyone know?
I use the write-review query parameter in my App Store URL to bring up the review prompt in the App Store app:
https://apps.apple.com/app/id0123456789?action=write-review
(0123456789 is just an example ID, obviously replace that with your app ID)
This is exactly what is supposed to be done as per the documentation: https://developer.apple.com/documentation/storekit/requesting_app_store_reviews#4312600
However, on macOS it just opens the product page as if I never put the query parameter in the URL. It works fine on iOS 18.2.
I am using macOS 15.2 beta 3 (24C5079e)
Feedback ID: FB15866683
Hi!
I'm currently developing an app to support artists.
This should include a shop where artists can buy digital resources to use in their projects.
Now the issue is how I handle this.
I know there are consumable and non-consumable IAPs and there is a limit of 10.000 IAPs per app.
Because my shop will have more than 10.000 items eventually, I try to use a different approach:
For every price I want to have, I create a generic consumable IAP with the price I want. Then I assign this IAP to the product.
To keep transactions safe, users need to sign-up before making a purchase.
When a user intends to purchase the item, I create a transaction with the item a user wants to purchase along with the user in my database and return a unique uuid. Then I attach this uuid with the transaction appAccountToken.
Then I listen to App Store Server Notifications and unlock the item for the user based on appAccountToken.
I already read about this extensively and other people seemed to be able to use it after explaining everything to Apple.
I tried to submit the first version of the app and it was rejected with reason:
Guideline 2.3.2 - Performance - Accurate Metadata
We noticed that the display names and descriptions for your promoted in-app purchase products are the same, which makes it hard for users to identify what they are purchasing from the App Store.
Next Steps
To resolve this issue, please revise the display names or descriptions for your promoted in-app purchase products to ensure each individual metadata item is unique.
Please note that display names for promoted in-app purchases can be up to 30 characters long, while descriptions can be up to 45 characters long.
If you have no future plans on promoting this in-app purchase product, you can delete the associated promotional image in App Store Connect.
All my consumable IAPs are named the same because it is generic and I don't really see how I would change this.
What kind of information do I need to supply to Apple to approve it?
Any insights or tips are highly appreciated.
Please help! I have a subscription IAP failing on tvOS 18.2 at:
func makePurchase(_ product: Product) async throws
{
let result = try await product.purchase() //ERROR OCCURS HERE (See error message below)
...
Xcode Console message: "Could not get confirmation scene ID for [insert my IAP id here]"
The IAP subscription was working fine on 18.1 and earlier, and the same IAP and code is also running fine on iOS 18.2. The tvOS error on 18.2 happens both in production and sandbox.
Are there any changes to StoreKit 2 which might cause this error?
I have has a the Storekit working in my application previously.
It uses the a iTunes songs ID and allows the user to purchase the track from iTunes within the app using a View.
its been fine in IOS 17 but since the update to 18 Ive not been able to get this to work.
the iTunes panel loads within the app and shows the track I wish to purchase. on clicking purchase I login with my Apple ID password. that then spins for a few seconds then asks to do the purchase again.
Can you please advise.
code below
print ("Store ID + \(self.appId)")
let storeProductViewController = SKStoreProductViewController()
storeProductViewController.delegate = self
let parameters = [SKStoreProductParameterITunesItemIdentifier: self.appId]
storeProductViewController.loadProduct(withParameters: parameters) { status, error -> Void in
if status {
self.present(storeProductViewController, animated: false, completion: nil)
print("success: \(status.description)")
} else {
if let error = error {
print("Error: \(error.localizedDescription)")
}
}
}
DispatchQueue.main.async {
self.isPresentStoreProduct.wrappedValue = false
}
}
Hello,
We're trying to implement and test offer codes in our app. We have create all the necessary items in the App Store. The app has been reviewed and approved for release. We have not published it yet. We are redeeming the offer using a URL that opens the App Store. When I redeem, the account is updated, but the app does not see the Transaction.
We implemented using this: https://developer.apple.com/documentation/storekit/transaction
First, we used the Transaction.updates and then we added Transaction.all and neither return any Transaction.
Any ideas with there are any other dependencies that are required here or recommendations for how to test?
Hello everyone,
I’m submitting my app for the first time, and I’m running into an issue with fetching my in-app purchase products in the release environment.
In the sandbox environment, everything works perfectly: my app can fetch and display the products from StoreKit without any issues. However, when I switch to the release environment, my app is unable to retrieve the in-app purchase products from App Store Connect.
Because the app can’t fetch the products, this results in an error when either a user or the App Review team attempts to make a purchase, effectively blocking the purchase process.
Has anyone encountered this before? Any guidance on troubleshooting or common mistakes to watch out for would be much appreciated. Thanks!
Hi. If the app is in landscape only and when the SKStoreProductViewController is presented, the safeArea changes to what looks like a portrait mode safe area. When the SKStoreProductViewController is dismissed, the safeArea does NOT revert back to the original values.
Is there a way to force the safeArea to "reset"? I've submitted some bug tickets through Apple Feedback but I haven't received any response about it.
The below code will pop up the SKStoreProductViewController and if you have a UIView that is constrained to the safe area, then you can visibly notice that the safe area is changed and doesn't go back.
I have tested this on iPhone 14 Pro, iPhone 15, and iPhone 16 Pro and in the Simulators. The incorrect behavior happens on those and probably more.
Thanks.
#import "ViewController.h"
#import &lt;StoreKit/StoreKit.h&gt;
@interface ViewController ()
@property (nonatomic, strong) SKStoreProductViewController *productViewController;
@end
@implementation ViewController
- (IBAction)buttonTapped:(id)sender {
self.productViewController = [[SKStoreProductViewController alloc] init];
NSDictionary *parameters = @{
@"id" : @"6443575749"
};
[self.productViewController loadProductWithParameters:parameters completionBlock:^(BOOL result, NSError * _Nullable error) {
[self presentViewController:self.productViewController animated:YES completion:^{
// presented
// The panel that is constraint to the safe area visibly shows that the safe area is no longer correct.
}];
}];
}
@end
Hi,
I want to apply in app purchases in my app. I have set it up in xcode and on appstoreconnect, it is saying ready to submit.
I dont understand what i need to do now to connect the two. I have read i need to send my app for review for them to be reviewed, but i want to test the in app purchases first on test flight and on sandbox before i send my app for review.
Please can someone clarify for me and help me?