SKProductsRequest delegate is not called

Even if I start a request for SKProductsRequest, didReceiveResponse, didFailWithError, and requestDidFinish are not called.

The first request successfully called didReceiveResponse and requestDidFinish.

However, didReceiveResponse, didFailWithError, and requestDidFinish are not called in the second and subsequent requests.

About 12 hours after the second request, when I started the request again, didReceiveResponse and requestDidFinish was called normally.

However, when I started the request immediately afterwards, didReceiveResponse, didFailWithError, and requestDidFinish were no longer called again.

I kept the SKProductsRequest as a strong reference and executed the start of the request.

https://developer.apple.com/documentation/storekit/skproductsrequest

Objective-c Code:


//SKProductsRequest request
@property (strong, nonatomic) SKProductsRequest *request;

_request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:_productIdentifiers]];

_request.delegate = self;

[_request start];


- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{

}

- (void)requestDidFinish:(SKRequest *)request
{

}

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error 
{

}

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions 
{

}

The following log is displayed in the console log of Xcode.

[BackgroundTask] Background Task 8 ("SKProductsRequest"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.

This phenomenon occurred in the following operating environment.

Xcode 13.0

iPhone 11 Pro / iOS 15.0

Deploy target iOS 13.0

SAND-BOX       

This phenomenon did not occur in the following operating environment.

Xcode 12.5.1

iPhone 11 Pro / iOS 14.5

Deploy target iOS 12.3

SAND-BOX

This method is called after all processing of the request has been completed. Typically, subclasses of SKRequest require the delegate to implement additional methods to receive the response. When this method is called, your delegate receives no further communication from the request and can release it.

https://developer.apple.com/documentation/storekit/skrequestdelegate/1385532-requestdidfinish

The documentation states that the request can be released after the delegate is called. What does that mean? Is this the phenomenon that the next request is not processed until the unreleased request expires?

Add a Comment

Accepted Reply

I get the same phenomenon. And what should I do? wait for resuloved

  • The phenomenon I encountered seemed to be due to a temporary failure in SANBOX.

    If it's the same cause, it may go away in a few days, but it's a good idea to send a feedback to Apple.

Add a Comment

Replies

The same phenomenon occurred with the sample code for in-app purchase provided by Apple.

Offering, Completing, and Restoring In-App Purchases

https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/offering_completing_and_restoring_in-app_purchases?language=objc

I get the same symptom when I download the sample code, change the product ids for team and in-app purchases to my own, build with Xcode 13 and run it on an iOS 15.0.1 device.

I checked it on multiple devices with iOS 15.0.1, but the same phenomenon occurred.

Is there something wrong with the SANDBOX?

A report similar to this phenomenon was posted on other sites last month, so I will introduce it. It seems that it has not been solved yet.

https://github.com/RevenueCat/purchases-ios/issues/851

https://stackoverflow.com/questions/67385235/background-task-9-skreceiptrefreshrequest-was-created-over-30-seconds-ago

When the delegate of SKRequest and SKProductsRequest is not called, the following log may not be displayed on the Xcode console.

[BackgroundTask] Background Task 8 ("SKProductsRequest"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.

Other threads in the forum have reported similar symptoms with this iOS 15 beta.

https://developer.apple.com/forums/thread/688416   

It is unknown at this time whether it is a phenomenon peculiar to SANDBOX or a bug in Xcode13 and iOS15.

I submitted a feedback to Apple. -> FB9679979

Three weeks after the phenomenon occurred, it started to operate normally.

The delegate of SKProductsRequest is called.

It is probable that the sandbox system failure was prolonged.

If your code is okay and your in-app purchase settings are okay, there is a possibility of a SANDBOX system failure.

If you continue to experience similar issues, send feedback to Apple and ask for immediate action.

I get the same phenomenon. And what should I do? wait for resuloved

  • The phenomenon I encountered seemed to be due to a temporary failure in SANBOX.

    If it's the same cause, it may go away in a few days, but it's a good idea to send a feedback to Apple.

Add a Comment

Our app just got rejected because of this. Is there any resolution at all? Just luck of the draw?

  • I'm not sure if Apple's review uses the SANDBOX environment to test in-app purchases. If Apple is reviewing using the SANDBOX environment, I think it could be rejected if the binary is submitted for review in a situation where this is happening in the SANDBOX environment.

    If Apple's review was rejected in a situation where this phenomenon did not occur in the SANDBOX environment, I think there is another cause.

Add a Comment