Connection from test builds denied after app goes live?

Hi,


We succesfully tested IAPs during development, and succesfully launched the app on the App Store.

However, since doing so, we cannot test IAPs at all with builds deployed directly to the devices from XCode. This will result in the error:

UnityIAP: SKProductRequest::didFailWithError: -1005, Error Domain=NSURLErrorDomain Code=-1005

with a lot of additional data, including:

NSErrorFailingURLKey=https://sandbox.itunes.apple.com/WebObjects/MZStore.woa/wa/fetchSoftwareAddOns


So, it would seem the app deployed by Xcode is requesting information from the sandbox server, and getting a denial since the app is now live.

My questions would be:

- Is this interpretation correct?

- If so, how can we properly continue testing with new development versions of a published app?


Many thanks in advance!

Accepted Reply

There was a problem with the sandbox system, which is now fixed. Check out https://developer.apple.com/system-status/

Hopefully your issue is now resolved.

Replies

To test IAPs in the sandbox environment the app must appear to be signed by a development something rather than a production something. The way to do that is to log out of the App Store, delete the old version of the app and then load a new version from Xcode (or TestFlight). Log into the app store only when asked to do so by StoreKit.


You cannot overlay a new version on an old version and expect the signing environment to change.


I notice you are getting a "UnityIAP" error - that is an error generated by some software you are using, not iOS.

Thanks for the reply!

However, that is exactly what has been attempted. No dice, Xcode deployed app will not connect to the store. The live application works well though.


I should add that *nothing* changed for one device from development>release.

1. The app deployed on the test device was dev signed from Xcode prior to app release

2. Post app release, the *same* application was used on the test device which had *not* seen a production signed version of the app.

3. Pre-release and in testing: worked fine. Post release, same app: no go.

4. Deleting the app and downloading the production app from the store: IAP works.

5. Deleting the app, signing out, deploying a development version from Xcode: IAP does not work, fails with error below.


And correct, the app is developed based on Unity and is using UnityIAP, which in turn implements StoreKit. The error message is consistent with a Storekit error:

SKProductRequest::didFailWithError: -1005, Error Domain=NSURLErrorDomain Code=-1005 "Kan inte ansluta till iTunes Store" UserInfo={NSLocalizedDescription=Kan inte ansluta till iTunes Store, NSErrorFailingURLStringKey=https://sandbox.itunes.apple.com/bag.xml?ix=6&os=10&locale=sv_SE, NSErrorFailingURLKey=https://sandbox.itunes.apple.com/bag.xml?ix=6&os=10&locale=sv_SE, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=54, NSUnderlyingError=0x174a47860 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=54, _kCFStreamErrorDomainKey=1}}}.


("Kan inte ansluta..." = "Cannot connect to iTunes Store")


I found another thread from late 2018 discussing this exact problem (not being able to test using sandbox, but the live app working well):

https://forums.developer.apple.com/message/369497#369497


Any further help would be much appreciated as this halts our development. Thanks in advance!


(...and FWIW, this has been logged as feedback #:FB6473089 )


We are experiencing the same issues. Having few live apps on the AppStore, which work fine. One of our apps didn't have in-app purchase products, so we just decided to add a new product. The update got rejected, because the test purchase couldn't be completed. We started looking for errors, however at this moment, when we test the very same builds we uploaded and got approved for all our apps, we get the same error. The sandbox mode is currently not working for any app.

In

"4. Deleting the app and downloading the production app from the store: IAP works."

did you log out of the app store with that test user and log back in with a real user? Or did you use the same user for sandbox and production? In the old days that would ruin a test user. I don't know if it still does that.


Have you checked with Unity to see if they know what might be wrong?


The 'error' message is referencing the website used to verify receipts. Does the Unity program verify receipts from the app?

Thanks for the reply.

The issue is not really related to the store account, as even with no user logged in, the IAP functionality will fail.

It basically fails after a delay when the receipt upon attempting to get product information from the store fails (with the enclosed error message).

So, when it is failing I have logged out from the store and not yet logged in at all.


A tangent: We had no issues whatsoever with test users vs. real users during the testing stages (pre-release). We did actually mix real and sandbox-accounts during testing on one occasion and it did not invanlidate accounts, so not sure if that still applies.

But just to be clear, this is not related to the current error where simply requesing product information will lead to an error for the app version deployed via Xcode, but the live app works exactly as expected.


Regarding what's happening behind the scenes, this is what kicks off the failure:


// Execute a product metadata retrieval request via GCD.

-(void) initiateProductPoll:(int) delayInSeconds

{

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);

dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {

UnityPurchasingLog(@"Requesting product data...");

request = [[SKProductsRequest alloc] initWithProductIdentifiers:productIds];

request.delegate = self;

[request start];

});

}


This is from UnityPurchasing.m and I haven't looked much further, but it preps a request for product info and starts it. This returns a failure, which is logged through UnityPurchasings log function, and the output is what I enclosed earlier.

So, this is not attempting any purchase transaction, nor is it triggering a login. We're simply requesting information, and since the app is signed as a dev app, we're sent to the sandbox environment but the request seems to be rejected.

Currently, I am pinning this on the Apple backend, but I am happy to be proven wrong.


Again, thanks in advance for any help.

There was a problem with the sandbox system, which is now fixed. Check out https://developer.apple.com/system-status/

Hopefully your issue is now resolved.

Thanks!

Would be awesome if the System Status page was more up to date. It was the first thing I checked when the problem started... Oh,well. 🙂