iOS 应用程序到 MacOS 错误 : 'transactionReceipt' is unavailable: not available on macCatalyst

标签 ios macos in-app-purchase porting mac-catalyst

我有一个 iOS/iPadOS 应用程序已在 App Store 中发布并销售。现在,使用 Xcode 11.1 到 MacOS 10.15 Catalina 或更高版本的“自动”端口,我只需标记“Mac”复选框并尝试在我的 Mac 上运行该应用程序,但出现以下编译错误:

“transactionReceipt”不可用:在 macCatalyst 上不可用

如何解决?我正在使用 StoreKit 框架,必须使用另一个框架吗?有没有办法调整 StoreKit 使其与 macCatalyst 一起工作?

最佳答案

一切都是为了替换:

transaction.transactionReceipt

与:

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

this SOF answer 上找到它.就我而言,不需要将 NSData 转换为 NSString。

关于iOS 应用程序到 MacOS 错误 : 'transactionReceipt' is unavailable: not available on macCatalyst,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58312916/

相关文章:

ios - CocoaPods - 在带有 link_with 的单元测试项目中使用 pod

macos - NSSplitViewController subview 未添加

python - Python GTK+ 3 教程 Hello World 中没有名为 'gi' 的模块

swift - makeFirstResponder 并不总是触发

iphone - SKProductsRequest 未返回任何产品

android - 您可以将应用作为应用内购买来销售吗?

iOS 10/Xcode 8 TestFairy 不记录

ios - 使用 for 循环将 UIImage 追加到数组中

ios - iOS 的 IAP 收据验证

iOS 14 PickerView 截断文本