Need a little help with StoreKit

Hi. Xojo 2021 R3.1. I downloaded the latest iOSKit and placed it in my project. I was going by an older app that was successfully published with IAP (going back a couple years) as a guide for the processes. In my new project, I am experiencing a very strange crash. Xojo shows the error then quickly quits the app before I can really look into it. It took a couple tries, but I managed to take a screenshot of the error Xojo before it quit and the message was lost. Screenshot below

I narrowed it down to when the modal window opens, which contains the following code in Opening

//List here all product IDs
dim productID() As Text = array("com.visualveggiessoftware.dietitianexamtogo.premium")

For each p as text in productID
  
  StoreKit.InAppPurchaseHelper.productIDArray.Append p
  
Next

Helper = StoreKit.InAppPurchaseHelper.GetInstance
Helper.Setup

try
  Helper.RequestProductsWithCompletionHandler(WeakAddressOf LoadProduct)
  
  AddHandler Helper.RemovedTransactions, WeakAddressOf RemovedTransactions
  AddHandler Helper.RestoreTransactionsCompleted, WeakAddressOf RestoreTransactionsCompleted
  AddHandler Helper.RestoreTransactionsFailed, WeakAddressOf RestoreTransactionsFailed
  
Catch err as runtimeException
  //Sometimes the AddHandler fails
  
  Try
    StoreKit.InAppPurchaseHelper.ClearInstance = True
    
    Helper = StoreKit.InAppPurchaseHelper.GetInstance
    Helper.RequestProductsWithCompletionHandler(WeakAddressOf LoadProduct)
    
    
    AddHandler Helper.RemovedTransactions, WeakAddressOf RemovedTransactions
    AddHandler Helper.RestoreTransactionsCompleted, WeakAddressOf RestoreTransactionsCompleted
    AddHandler Helper.RestoreTransactionsFailed, WeakAddressOf RestoreTransactionsFailed
    
  Catch err2 As runtimeException
    
    
    StoreKit.InAppPurchaseHelper.ClearInstance = True
  End Try
  
End Try

Here is a portion of the crash log. If this does not help, and you need to see more, let me know

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: UNKNOWN_0xD at 0x0000000000000000
Exception Codes: 0x000000000000000d, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4443312128
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
—>
__TEXT 108d79000-1091ae000 [ 4308K] r-x/r-x SM=COW …an Exam.debug
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [1863]

Not sure if this is anything, but I noticed StoreKit as some variables declared as Text. I thought String was to replace Text, but maybe not in this case

You could use StoreKit classes in MBS Xojo Plugins instead, if you need an alternative implementation for Xojo.

If the callback comes on another thread, the Xojo delegates won’t work well and the plugin handles this for you.

Thanks Christian. And the MBS plugin works with iOS? Is it easy to implement? Examples to follow?

The plugin supports iOS. See StoreKit

The classes should be very similar and we have a test project, which could help.
You should be able to copy the RequestProducts part into your project easily and try it.

Checking out now. Thanks for the tip!

Hi Christian. So I am testing this out in my app before purchasing the plugin. I am getting an error in the AppStoreModule.Init call in app.Opening saying “FunctionNotFound: SKPaymentQueue class missing”

I searched the test project and do not see an SKPaymentQueue but do see SKPaymentQueueMBS as a Super in mPaymentQueue, and this is also present in my project. What am I missing? I did add the plugins (Main, MacCloud, and MacBase) as instructed

Well, our class is named SKPaymentQueueMBS, so you may need to change your code to adapt to the MBS class names there.

Right, but I have no calls to SKPaymentQueue (without the MBS), and the crash happens during the Init method in AppStoreModule (I copied the whole AppStore folder from the MBS test project…maybe this was not correct?)

I just made a new project with only the AppStore folder and am calling the AppStoreModule.Init in app.Opening, and the same result “SKPaymentQueue class missing”. Is there another plugin I failed to add? The 3 were added. Closed and quit Xojo. Opened the file, ran, and error

I can check tomorrow.
Maybe something changed and loading StoreKit framework is now different.

No hurry. I am shutting down for the night now anyway. Thanks Christian!

All mbs classes for StoreKit should work, check if you set a wrong (non-mbs) class to some property perhaps ?
Also remove any other bindings to storekit. (ioskit storekit)

I got an example working:

We’ll include it for next version and I can email you a copy.

Please get on the @Testers channels to download a beta of next version of Xojo.
This example reproducible crashes in Xojo 2021r3.1 when running here, but works in newer beta, so whatever bug this is, got already fixed.

Thanks for the replies fellas. Christian, I got the email with the sample project. Thanks! I’ll have to see about getting a tester account as I am using 2021 r3.1, so if you know that will crash, then I’ll need the beta

Feel free to try 2021r3.1, but for me it crashed in debugger when adding rows to the list box.

I tried out the test project you sent Christian and still got the same error message that the SKPaymentQueue class (not the MBS one) is missing. I did not modify the file you sent. Just opened and ran. Crashed on app.Opening in the AppStoreModule.Init method (first line), so it never even got to the table loading crash you noticed on 2021 r3.1

There has to be something I am missing. Confirmed that the plugins folder does contain the 3 required MBS plugins (MacBase, MacCloud, and Main)

Sorry, but I can’t reproduce this.
Maybe you like to email me and we make a screen sharing meeting, where we check on your computer while the StoreKit framework was not loaded.

I appreciate your help. I will send you an email with Zoom so we can screen share. Thank you!

We can check. This may be anything like a bundle identifier without provision profile or not allowed for some permission.