【问题标题】:How to convert data from an inapppurchase to the format needed for Fabric Answers如何将 inapppurchase 中的数据转换为 Fabric Answers 所需的格式
【发布时间】:2015-07-23 05:57:17
【问题描述】:

Twitter 为 Fabric 推出了一项新功能,允许 tracking of events。特别是可以使用以下 API 跟踪付款:

[Answers logPurchaseWithPrice:[NSDecimalNumber decimalNumberWithString:@"13.50"]
                 currency:@"USD"
                  success:@YES
                 itemName:@"Answers Shirt"
                 itemType:@"Apparel"
                   itemId:@"sku-350"
         customAttributes:@{}];

我想通过应用内购买跟踪付款。

当在- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions 内购买成功时,如何获取这些参数就很明显了。例如

[Answers logPurchaseWithPrice:skProduct.price
                 currency:???
                  success:@YES
                 itemName:skProduct.localizedDescription
                 itemType:@"in app purchase"
                   itemId:aTransaction.payment.productIdentifier
         customAttributes:@{}];

获取应该是 ISO4217 货币代码的货币字符串的最佳方法是什么?

【问题讨论】:

  • skProduct.priceLocale.localeIdentifier?
  • priceLocale 是一个很好的线索,谢谢

标签: ios in-app-purchase twitter-fabric


【解决方案1】:

货币代码可从:

[skProduct.priceLocale objectForKey:NSLocaleCurrencyCode]

【讨论】:

    猜你喜欢
    • 2021-04-25
    • 2021-12-05
    • 2019-11-21
    • 2021-01-01
    • 2017-09-06
    • 1970-01-01
    • 1970-01-01
    • 2018-12-24
    • 2014-01-05
    相关资源
    最近更新 更多