Purchase never completes on iOS 16, but works on older versions.

  • 26 September 2022
  • 18 replies
  • 618 views

Userlevel 1
Badge +2

I'm trying to make a purchase using the method below, it prompts me to enter the password, it works fine but the completion block is never called. It seems to be a bug in iOS 16, because in iOS 15 everything works as expected.

I'm using this code to make the purchase:

 

              [[RCPurchases sharedPurchases] purchasePackage:obj withCompletion:^(RCStoreTransaction *transaction, RCCustomerInfo *customerInfo, NSError *error, BOOL cancelled) {
                
                  
              }];

 

How do I enable the StoreKit 2 in Objective-C? Maybe it will work using StoreKit 2. Thank you!


18 replies

Userlevel 3
Badge +8

Try

    RCConfigurationBuilder *configBuilder = [RCConfiguration builderWithAPIKey:Yourkey];

    configBuilder = [configBuilder withAppUserID:YourUserID];

    configBuilder = [configBuilder withUsesStoreKit2IfAvailable:YES];

    [RCPurchases configureWithConfiguration:[configBuilder build]];

Userlevel 1
Badge +2

Thank you so much for the code! Where do I find the AppUserID?

Userlevel 1
Badge +2

Thanks for the code! But it didn't solve the problem. With this configuration the purchase doesn't eve go through anymore.

Userlevel 3
Badge +8

… doesn't even go through anymore.

So when you make withUsesStoreKit2IfAvailable=true no iOS prompt for purchase?

Have you upgraded to iOS 16 Beta 3?

Userlevel 1
Badge +2

There is no prompt for purchase. I'm using the release iOS 16.0.2, not iOS 16 Beta. Should I wait for another update from Apple?

Userlevel 3
Badge +8

I use purchaseProduct and it works fine (iOS 16 is fine, SDK Swift Package repository main).  Can you try it out?

[[RCPurchases sharedPurchases] purchaseProduct:product withCompletion:^(RCStoreTransaction * _Nullable transaction, RCCustomerInfo * _Nullable info, NSError * _Nullable error, BOOL userCancelled) {

     

    }];

Userlevel 1
Badge +2

The log says:

[Purchases] - INFO: 💰 Purchasing Product

But it doesn't prompt for the purchase. I'm using iOS 16.0.2 with Revenuecat SDK 4.13.0 via Cocoapods. What SDK are you using?

Thank you!

Userlevel 3
Badge +8

I am using 4.13.0, iOS 16 Beta 3.  

So you tried product instead of package?

You can test on real device before you release the app to the App Store, you don’t have to buy, just cancel.

Userlevel 1
Badge +2

I tried to purchase a product instead of package and it doesn't prompt me for the purchase.

Userlevel 3
Badge +8

Try turning off withUsesStoreKit2IfAvailable and use the product.

Userlevel 1
Badge +2

It worked! Thank you very much for your help!!!

Badge +2

After updating to iOS 16 I am having a similar issue on Flutter. I’m using “purchases_flutter: ^4.3.0” which is the latest as of now.

Calling the ‘Purchases.purchasePackage(package)’ doesn’t display the Store Kit when the ‘usesStoreKit2IfAvailable’ is set to true. But it still proceeds with the purchase as the method returns the CustomerInfo object, and my app treats it as a successful purchase. However, in this case the ‘You’re all set. Your Purchase was successful.’ popup is not displayed. Setting the ‘usesStoreKit2IfAvailable’ to false fixes everything.

Userlevel 1
Badge +2

For me, unfortunately it stopped working again. SKPaymentTransactionStatePurchased is never called.

Badge

Did anyone find a solution to this? I am having a similar issue that the completion is never called; only when I cancel the purchase.

I use Swift and already tried the method for purchasing a product, the method for purchasing a package, tried it with usesStoreKit2IfAvailable true/false, created a new sandbox user etc. and I always have the same behaviour: The purchase pop-up from Apple shows up correctly, I tap purchase, enter the sandbox users password, the purchase is successful and then nothing. I already tried to set breakpoints and print stuff in the completion handler but for some reason it just does not get called. 

The only thing that happens, are the two additional lines in the logs after “INFO: Purchasing ….”

2022-10-30 20:11:07.657425+0100 MTExamples[876:96268] [Purchases] - INFO: 💰 Purchasing Product 'mtexamples.iap.example'

2022-10-30 20:11:23.401118+0100 MTExamples[876:96268] [Purchases] - DEBUG: ℹ️ applicationDidBecomeActive

2022-10-30 20:11:37.687228+0100 MTExamples[876:96490] [tcp] tcp_input [C1.1.1.1:3] flags=[R] seq=2104917270, ack=0, win=0 state=LAST_ACK rcv_nxt=2104917270, snd_una=4154251886

 

And when I then trigger the function again, only the “INFO: Purchasing...” log shows up again and nothing else happens, not even the pop up is showing then up anymore, only when I run the app again.

I am using Xcode 14.0.1, RevenueCat 4.13.4 and an iPhone 13 Pro with iOS 16.0

Userlevel 1
Badge +2

I haven't found a solution for this, unfortunately. It only happens with iOS 16 and up and I have the same configuration as yours. It also happens with StoreKit for me. I think that we need to file a radar with Apple.

Badge

Yeah I also kinda had the same behavior with StoreKit, I was just not sure if it was my fault since I never used StoreKit before. It basically never run the code after StoreKit’s async purchase function, even when on the UI side the purchase was actually done already.

 

I will submit a bug report via the Feedback Assistant, if I get any new information I will keep you up to date. 

Userlevel 1
Badge +2

Thank you for posting any updates from Apple here.

Badge

So, Apple just answered me on my feedback and asked me to create a sysdiagnose of the issue - just when I wanted to reproduce the issue, it suddenly worked and I have no idea why 😅 The only thing I did, was that I setup a local StoreKit Configuration and set in my schemes. But now also after setting the configuration back to none so it uses the remote products, it suddenly works with both purchase functions - RevenueCat ones and StoreKit ones. 

 

@Neo Winston Can you check if it also works for you now? If you still have issue, just let me know if I can help you somehow - otherwise maybe also submit a feedback, they answered me after 1-2 days.

Userlevel 1
Badge +2

Thanks for the update!

 

I did set a local StoreKit Configuration file, but I still can't make it work. In fact, sometimes it works, sometimes it doesn't.

Reply