SKProductsRequest delegate methods are never calle

2019-01-27 20:36发布

This used to work for me but is now not working anymore and I can't figure out why. I have in-app purchase setup in my app. I confirmed that I have a correct set of product identifiers, matched by corresponding in-app purchase items in itunesconnect. The call goes out to Apple view [productRequest start], but I never get a response back, despite setting the delegate to myself. What am I missing?

NSLog(@"productIdentifiersSet: %@", productIdentifiersSet);
if ([productIdentifiersSet count]) {
    SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiersSet];
    [productRequest setDelegate:self];
    [productRequest start];
}

………

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
   <never called>
}

- (void)requestDidFinish:(SKRequest *)request {
    <never called>
}

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
    <never called>
}

2条回答
Anthone
2楼-- · 2019-01-27 20:47

The same problem happened to me today. In the morning my code was working, in the afternoon it didn't work for 3-4 hours. I spent all of my time and tried many things. But a little time before, it started working itself. I didn't change anything.

I suppose we can't trust apple servers about that..

查看更多
▲ chillily
3楼-- · 2019-01-27 20:48

Here it's a good check list that can solve this issues:

  1. Go to Settings\iTunes & App Stores, log out of any account, and try again so you’re sure you’re using a Sandbox account.
  2. Check this link – if it doesn’t respond, the iTunes sandbox may be down.
  3. Have you enabled In-App Purchases for your App ID?
  4. Does your project’s .plist Bundle ID match your App ID?
  5. Are you using the full product ID when when making an SKProductRequest?
  6. Have you waited several hours since adding your product to iTunes Connect?
  7. Are your bank details active on iTunes Connect?
  8. Have you tried deleting the app from your device and reinstalling?
  9. After you've created your in app purchase products, remember to add those to your game-app in you app page in ituns connect.
查看更多
登录 后发表回答