macOS TestFlight app using Xcode environment for IAP

I don't know how this happened or how to reset this, but I can't test the StoreKit part of my TestFlight app anymore. When I try to retrieve or buy products (IAPs), I get all kinds of strange behavior. I think it is caused by storekitagent thinking the app is in "Xcode sandbox environment".

One of the errors from storekitagent looks like this: [51852D62] [LoadSubscriptionStatusTask]: Subscription status request failed with error - Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={AMSStatusCode=0, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <468756B3-DA53-4FED-B35C-E093954C27D8>.<1>, NSErrorFailingURLKey=http://localhost:49828/inApps/subscriptions?guid=98DD60024C21&reason=push, _kCFStreamErrorDomainKey=10, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <468756B3-DA53-4FED-B35C-E093954C27D8>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=http://localhost:49828/inApps/subscriptions?guid=98DD60024C21&reason=push, NSUnderlyingError=0x122f638d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _kCFStreamErrorCodeKey=-72000}

It looks like it's trying to connect to a local server instead of contacting Apple's App Store servers.

I'm on the latest macOS and Xcode.

Any help is greatly appreciated:) Thanks!

I've run into a similar thing.

I have local IAP testing setup. And usually it works OK.

Then after whatever reason it stops. It seems to expect a local server that acts as a AppStore mock. But that server has crashed. The sad thing - I have to reboot the machine to bring it back up and get it working again.

It would be lovely if the Xcode/StoreKit2 team would fix this. I suspect there might be a way to somehow restart the service. But I haven't figured out how. One would have expected restarting Xcode should be all it takes but... that does not seem to be the case.

Dear Apple - do better.

Same problem for me.

StoreKit testing with Xcode is fine in the iOS simulator, but in Mac Catalyst I get this error and StoreKit does not work.

If I restart the Mac, it works at least once, but soon this error occurs. StoreKit2 will not work in Mac Catalyst until I restart the OS again.

Is there any solution?

Error enumerating all current transactions: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={AMSStatusCode=0, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DBD4B067-89AC-4809-917E-81B13424EF0A>.<1>, NSErrorFailingURLKey=http://localhost:49193/inApps/history?guid=5CE91EC388E2&reason=timer, _kCFStreamErrorDomainKey=10, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <DBD4B067-89AC-4809-917E-81B13424EF0A>.<1>"
), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=http://localhost:49193/inApps/history?guid=5CE91EC388E2&reason=timer, NSUnderlyingError=0x600000d44db0 {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}

macOS Sonoma 14.1.2 Xcode Version 15.0.1

This is also happening to us (macOS menu bar extension app).

Even our customers (downloaded the app via App Store) report this problem after updating their app on macOS to a new version, which is a bigger issue, as not only developers / TestFlight users are experiencing this but paying users.

Who else is having this problem and who has a fix for it? Telling people to restart their computer is a bad customer experience...

I'm getting this using Xcode storekit testing as of today. It was working fine, and now I can't test in Xcode or the Sandbox. A mix of error messages, mostly referencing server hostnames not being found. Anyone know what's happening?

What worked for me was looking for this process and killing it:

/System/Library/Frameworks/StoreKit.framework/Support/storekitagent

Or, just killall -9 storekitagent.

macOS TestFlight app using Xcode environment for IAP
 
 
Q