This question already has an answer here:
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?
The constant
SKErrorPaymentCancelled
has been removed from the SDK as of iOS 9.3. Instead, use theSKErrorCode.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.