Search code examples
iosmacosin-app-purchaseportingmac-catalyst

iOS app to MacOS error: 'transactionReceipt' is unavailable: not available on macCatalyst


I have an iOS/iPadOS app already published and selling in the App Store. Now with the "automatic" port of Xcode 11.1 to MacOS 10.15 Catalina or higher, I just marked the "Mac" checkbox and tried to run the app on my Mac, but I got this compile error:

'transactionReceipt' is unavailable: not available on macCatalyst

How to solve? I'm using StoreKit framework, have to use another one? Is there a way to adapt StoreKit to make it work with macCatalyst?


Solution

  • It`s all about replacing:

    transaction.transactionReceipt
    

    with:

    [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
    

    Found it on this SOF answer. In my case there was no need to convert NSData to NSString.