Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certificate issue on device #49

Closed
EPage-Ed opened this issue Apr 1, 2023 · 4 comments
Closed

Certificate issue on device #49

EPage-Ed opened this issue Apr 1, 2023 · 4 comments

Comments

@EPage-Ed
Copy link

EPage-Ed commented Apr 1, 2023

iOS 16.4 (though same problem with iOS 16.3), Xcode 14.2 and 14.3.

Doing a non-consumable in-app purchase.
Code was running fine a few months ago, and recently started on an update, and encounter this issue. Running on simulator works as before - purchase validates and updates just fine. Running on a device (iPhone 12 Pro with 16.3 or 16.4) fails validation with:

2023-04-01 00:16:39.288226-0700 XXXXX[27827:2726419] [Default] Failed to verify certificate chain due to client recoverable failure:
Error Domain=NSOSStatusErrorDomain Code=-67843 "“StoreKit Testing in Xcode” certificate is not trusted" UserInfo={NSLocalizedDescription=“StoreKit Testing in Xcode” certificate is not trusted, NSUnderlyingError=0x28259a550 {Error Domain=NSOSStatusErrorDomain Code=-67843 "Certificate 0 “StoreKit Testing in Xcode” has errors: Root is not trusted;" UserInfo={NSLocalizedDescription=Certificate 0 “StoreKit Testing in Xcode” has errors: Root is not trusted;}}}
2023-04-01 00:16:39.289279-0700 XXXXXX[27827:2726418] [Default] Failed to verify signature for Transaction, will assume invalid: failedToVerifyCertificateChain

@russell-archer
Copy link
Owner

russell-archer commented Apr 1, 2023 via email

@russell-archer
Copy link
Owner

I can't reproduce this I'm afraid. This is what I did to reproduce the issue:

Setup:

  • Running on macOS Ventura 13.3 (22E252), Xcode 14.3 (14E222b)
  • Using a real iPhone XS running iOS 16.4
  • Opened an iOS/macOS Xcode project for an app I have live in the App Store
  • Updated packages to get the latest version of StoreHelper

StoreKit testing on real device:

  • Did a Clean Build Folder and rebuilt for iOS 15 for local StoreKit testing (debug build, with a .storekit file)
  • Deployed to the real device
  • All products correctly retrieved from the App Store and shown using correct local prices
  • Purchased a product
  • Product was correctly shown as purchased within the app and validation suceeded
  • Was able to access the functionality purchased
  • Stopped the app running
  • Deleted the app from the device

Sandbox testing on real device:

  • Did a Clean Build Folder and then rebuilt for iOS 15 using a scheme for sandbox testing (debug build, no .storekit file)
  • Used App Store Connect to remove all previous purchases for my sandbox test account
  • On the real device setup my sandbox account in Settings > App Store > Sandbox Account
  • Deployed to the real device
  • All products correctly retrieved from the App Store and shown using correct local prices
  • Started the process to purchase a product
  • Was correctly prompted to sign in to the App Store with my sandbox account
  • After signing in purchase proceeded and completed normally
  • Product was correctly shown as purchased within the app
  • Was able to access the functionality purchased
  • Stopped the app running
  • Deleted the app from the device
  • Repeated the above steps but built for iOS 16.4 this time
  • Again, purchase process worked correctly and without errors

I also removed the app from another real device and re-installed from the real App Store. Previous purchases were correctly recognized, auto-restored and validated.

So, it passes the "it all works on my machine" test! :-)

But what could be causing your issues? Actually, those errors about "StoreKit Testing in Xcode certificate is not trusted" look familiar. I seem to remember seeing something similar about 6 months ago, but only related to macOS builds. I never got to the bottom of it and a new version of Xcode seemed to cure it.

A couple of ideads:

  1. I wonder what would happen if you create a completely new, very simple demo app that uses StoreKit testing WITHOUT using StoreHelper. If you see the same errors it would indicate something related to your setup.
  2. Have you tried using sandbox testing? I have a feeling that might work because it's using a different certificate for validating transactions.

Let me know how you get on - I'm happy to help if I can.

Russell

@EPage-Ed
Copy link
Author

EPage-Ed commented Apr 1, 2023

Success! You gave me a clue about the Sandbox account. I think my old one was just "old". Created a new one (a bit of a pain), turned off .storekit file, ran on device from Xcode, did purchase and it worked. Thanks!

Great response and thanks for getting to it so quickly. Can I give the repo a second star? ;-)

@EPage-Ed EPage-Ed closed this as completed Apr 1, 2023
@russell-archer
Copy link
Owner

Excellent! So glad you got it sorted out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants