ios - 使用 SKPayment 未完成交易

标签 ios objective-c xcode in-app-purchase skpaymenttransaction

我尚未在应用程序中完成交易,因此当我尝试使用此 ID 购买应用程序内时,我收到此消息:

this in app purchase has already been bought it will be restored for free

但是当我按下“确定”按钮时,委托(delegate)方法从未被调用。

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
}

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
}

我如何捕获一些事件来完成此交易?

最佳答案

当用户尝试购买某物时,为什么不首先检查该购买是否已在队列中?

BOOL alreadyInProgress = NO;
for (SKPaymentTransaction *tx in [[SKPaymentQueue defaultQueue] transactions])
{
    alreadyInProgress |= [tx.transactionIdentifier isEqualToString:productId];
}
if (alreadyInProgress)
{
    // Alert that the purchase is already active
}
else
{
    // Your purchase flow
}

关于ios - 使用 SKPayment 未完成交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39179750/

相关文章:

cocoa - 如何在 cocoa 中检测电源键何时被按下?

ios - 检测 webview 视频何时在 ios8 上变为全屏

ios - 让 UITableViewCell 使用自动布局调整自身大小

objective-c - fmdb executeUpdate 失败

xcode - 命令 CompileAssetCatalog 失败,退出代码为非零

iPhone 应用程序收听广播

iOS:向 IP 地址发出 shell 命令

ios - adMob iOS 恢复(返回应用程序按钮)

ios - UILabel 仅在放置在 viewcontroller 的 viewDidAppear 中时显示

iphone - 使用 Quartz CGContextFillEllipseInRect 绘制两个圆