Jump to content
Eric58

Recent crashes with macOS StoreKit that never occured previously

Recommended Posts

For those who have apps on macOS App Store, have you encountered this situation I've been facing in recent months? :

 

The app review team started rejecting my submissions recently because whenever they tried to execute the IAP code on my app, the app just crashed.  The specific StoreKit API that led to the crash is the one to do with ProductRequests.start.

 

My app has been on the store for 3 years, and there has been no change to my IAP-related code all this while.   I experimented with putting a Sleep(1000) just before calling that API, and the incidence of crash was somewhat reduced (and I managed to sneak in a submission once using this temporary hack).  However, this is still not a solution since it still crashes sporadically, and later submissions were rejected because the crash happened during app review.

 

The scant information I got from attempting to debug indicated that the symbol "StoreKit" couldn't be found.  This led me to suspect that Apple's deprecation of StoreKit, switching to StoreKit 2, a few months ago may have something to do with this.  But I'm just not sure, because the API call still works occasionally.

 

Has anyone any insight about this?  Also, is anyone aware of a StoreKit 2 (which is based on Swift) binding for Delphi available somewhere that I can perhaps explore as a solution?

Share this post


Link to post
Posted (edited)

A bit more concrete info, my IAP code is based on the one shared by Hans a few years ago, which I believe quite a few of us are now familiar with:

 

In my case, the specific call where the sporadic crash occurs is the last line of my adaptation of Han's code:

 

procedure TMacOSAppPurchaseService.QueryProducts(const ProductIDs: TStrings);
var
  ProductIDsArray: NSMutableArray;
  ProductIDsSet: NSSet;
  ProductID: string;
begin
  ProductIDsArray := TNSMutableArray.Create;
  for ProductID in ProductIDs do
    ProductIDsArray.addObject(PStrToNSStr(ProductID));
  ProductIDsSet := TNSSet.Wrap(TNSSet.OCClass.setWithArray(ProductIDsArray));
  FProductsRequest := TSKProductsRequest.Wrap(TSKProductsRequest.Alloc.initWithProductIdentifiers(ProductIDsSet));
...
  FProductsRequest.setDelegate(FProductsRequestDelegate.GetObjectID);
  FProductsRequest.start
end;
Edited by Eric58

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×