Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved Identifier - SKErrorPaymentCancelled [duplicate]

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.

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)
}

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?

like image 758
mattdonders Avatar asked Mar 22 '16 14:03

mattdonders


1 Answers

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

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.

like image 64
JAL Avatar answered Oct 07 '22 17:10

JAL