【问题标题】:Getting started with RevenueCat in-app billing on Xamarin Forms / MAUIXamarin Forms / MAUI 上的 RevenueCat 应用内计费入门
【发布时间】:2022-07-18 17:03:34
【问题描述】:

我找不到任何有关在 Xamarin 表单中使用 RevenueCat 绑定的文档或任何示例。如何开始?我认为这应该是显而易见的,但它不适合我。

在下面回答我自己的问题,我做了一个小小的开始,还没有测试任何代码。请随时扩展或更正。

这适用于 Visual Studio 2022 for Mac 上的 Xamarin Forms iOS; Android 和 MAUI 可能很相似。

【问题讨论】:

    标签: xamarin.forms maui revenuecat


    【解决方案1】:
    1. 在您的 iOS 项目中,添加 Nuget 包 Xamarin.RevenueCat.iOS 和 Xamarin.RevenueCat.iOS.Extensions。
    2. 在您的解决方案中:文件 > 添加 > 项目 > iOS > 绑定库。
    3. 将项目命名为 RevenueCatiOSBindingsLibrary(例如)。
    4. https://docs.revenuecat.com//docs/ios,下载购买iOS for Swift Package Manager 并解压缩。
    5. 展开解压后的文件夹以发现 RevenueCat.framework 文件夹,并将此文件夹添加到您的 iOS 项目中。
    6. 展开 RevenueCatiOSBindingsLibrary,右键单击 Native References 并选择 RevenueCat.framework 文件夹(从您的项目认为它所在的位置)。
    7. 在您的 iOS 项目中,添加对 RevenueCatiOSBindingsLibrary 的引用。
    8. 在提交 App Store 之前,可能需要添加 Xamarin.SwiftSupport Nuget??

    一些示例代码行:

    using RevenueCat;
    using Xamarin.RevenueCat.iOS.Extensions;
    ....
    RCPurchases.DebugLogsEnabled = true;
    RCPurchases.ConfigureWithAPIKey( "my api key" );
    RCPurchases.SharedPurchases.AllowSharingAppStoreAccount = true;
    RCCustomerInfo purchaserInfo = await RCPurchases.SharedPurchases.RestoreTransactionsAsync ();
    RCOfferings offerings = await RCPurchases.SharedPurchases.GetOfferingsAsync ();
    

    参考:https://riptutorial.com/xamarin-ios/example/21231/binding-a-swift-library-in-xamarin-ios

    【讨论】:

      猜你喜欢
      • 2023-02-23
      • 2022-08-21
      • 2021-09-20
      • 1970-01-01
      • 2017-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多