iOS In-App Purchases: Sandbox Invalid Product ID

2019-03-26 23:11发布

问题:

Background on the slightly odd setup before I get to the problem: Working on an app for a client and we're using an different iTunes developer account than the one this will eventually be published on for development and Ad-Hoc builds of an app that has Game Center and IAP integration. Obviously, we'll eventually have to duplicate our setup on the final release account, but the issue seems to be unrelated.

The issue is trying to test In-App Purchases in the sandbox. We do not have any Tax/Banking info in the interim account, it was not set up in my name so I can't just add mine. Right now, every time we send an SKProductsRequest with the Product Identifier for the product I've added in the iTunes Connect portion of the account for the interim app, it is returned in the response as an invalid product identifier.

This request where identifiers is an array with the string product identifier I'm trying to get:

_productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:identifiers]];
_productsRequest.delegate = self;

And this delegate method:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
   /*Other code for handling valid responses*/ 

    for (NSString *invalidProductId in response.invalidProductIdentifiers) {
        DLog(@"Invalid product id: %@" , invalidProductId);
    }
}

Returns this log for the identifer:

 -[InAppPurchaseManager productsRequest:didReceiveResponse:] Invalid product id: [Product ID That matches the one in ITC exactly]

I know ITC is working in the interim account because all our GameCenter sandbox integration is working fine through that.

Other things to note:

  • Same results on Simulator and multiple devices.
  • Logged out of normal iTunes/App store accounts on sim and all devices.
  • Tried waiting 24 hours and trying again.
  • Tried adding a different Product and trying its identifier (though I didn't wait 24 hours on this one).
  • Took a look at this: Resolving invalid product id issue with in-app purchases? and didn't see anything terribly helpful, unfortunately.

At this point, I'm stumped. Other than getting the person who set up this interim account to add their tax/banking info, is there anything I can do to actually get a valid product back from the SKProductsRequest?

Any help would be greatly appreciated. Thank you!

回答1:

Wound up having to get everything moved over to the final account, which did have banking and tax info. Exact same code that returned invalid product IDs was totally fine once I set the IAP up with the same name in the other account's app.

So yeah, you need the banking and tax info to even test in the sandbox. Boo-urns.



回答2:

Just wanted to confirm what DesignatedNerd said, about having to have a paid app agreement with Apple before testing can work. I had that yesterday, where we were using our account to test in app products on an app we're doing for a client. After a lot of web searching and other attempts, I happened to notice the text that said that we didn't have an agreement in place. We entered all our bank details in itunesconnect, and a little while later the message was gone, and my in app testing started to work.