Verify MAS receipt crash

  1. 6 weeks ago

    George A

    Aug 2 Pre-Release Testers, Xojo Pro

    I've been trying to submit an app to the Mac App Store that uses Monkeybread plugin for verifying MAS receipts. It runs just fine on my end (and I tested on multiple systems, with a receipt in the bundle and without). But every time the reviewer tests it it crashes immediately on app startup where I check for receipt. I have submitted multiple builds trying different things and it still crashes no matter what. Here is the code:

     If receipt <> Nil Then
        If receipt.purchaseDate.SQLDate < "2019-07-25" Then Return True // receipt is valid because it was downloaded before switch to in app purchase system
        
        Dim inAppPurchases() As AppReceiptIAPMBS = receipt.inAppPurchases
    
        if inAppPurchases <> nil then
        
            For Each p As AppReceiptIAPMBS In inAppPurchases
                If p <> nil and p.productIdentifier = "abc123" Then Return True // user purchased in app purchase so receipt is valid
            Next
        end if
    end if

    This code raises a nilobjectexception for the reviewer and I have no idea why. I am checking for nil's everywhere. The app is wrapped with AppWrapper. I am making a switch from paid app to free app with in app purchase, which is why I check for purchaseDate. What could I be missing? Could this be an entitlement issue? Thanks!

  2. Norman P

    Aug 2 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    Make sure you also check if the receipt purchaseDate is not nil
    The second line could, if the purchaseDate is nil raise an NOE

  3. George A

    Aug 2 Pre-Release Testers, Xojo Pro

    Thanks Norman. It sure could be nil thanks for pointing that out.

or Sign Up to reply!