未解析的标识符 - SKErrorPaymentCancelled [英] Unresolved Identifier - SKErrorPaymentCancelled

查看:909
本文介绍了未解析的标识符 - SKErrorPaymentCancelled的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着iOS 9.3及更新版本的发布,我更新到最新版本的Xcode 7.3 OSX 10.11.4(包括Swift 2.2)昨天。

I updated to the latest version of Xcode 7.3 with the release of iOS 9.3 & OSX 10.11.4 (inclusive of Swift 2.2) yesterday.

当我构建我的应用程序时,我收到一条错误,声明
使用未解决的标识符'SKErrorPaymentCancelled'我用它来检查用户是否取消了付款。我没有做任何特别的事情,只记录它(如下所示)。

When I build my app I get an error stating Use of unresolved identifier 'SKErrorPaymentCancelled' which I use to check if the user has cancelled a payment. I don't do anything special with it, just log it (as seen below).

private func failedTransaction(transaction: SKPaymentTransaction) {
    print("failedTransaction...")
    if transaction.error!.code == SKErrorPaymentCancelled {
        print("Transaction Cancelled: \(transaction.error!.localizedDescription)")
    }
    else {
        print("Transaction Error: \(transaction.error!.localizedDescription)")
    }
    SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}

我在Swift 2.2更新日志中找不到任何内容说明StoreKit中的任何内容都已更改。这在我更新之前工作正常。

I can't find anything in the Swift 2.2 changelog that states anything within StoreKit was changed. This worked fine before I updated.

还有其他人看到这个问题吗?

Is anyone else seeing this issue?

推荐答案

从iOS 9.3开始,SDK中已删除常量 SKErrorPaymentCancelled 。相反,请使用 SKErrorCode.PaymentCancelled enum。

The constant SKErrorPaymentCancelled has been removed from the SDK as of iOS 9.3. Instead, use the SKErrorCode.PaymentCancelled enum.

了解更多信息,请参阅 Swift的StoreKit更改 iOS 9.3 API Diffs 和我的规范Q& A的页面发布在iOS 9.3 / Xcode 7.3中使用StoreKit常量时使用未解析的标识符

For more information, see the StoreKit Changes for Swift page of the iOS 9.3 API Diffs and my canonical Q&A post Use of unresolved identifier when using StoreKit constants with iOS 9.3/Xcode 7.3.

这篇关于未解析的标识符 - SKErrorPaymentCancelled的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆