Search code examples
swiftxcodeerror-handlingin-app-purchase

Cannot find type 'SKPaymentTransactionObserver' in scope


I am trying to implement in-app purchases for my app.

import StoreKit
import UIKit

class BuyStoreViewController: UIViewController, SKProductsRequestDelegate, SKPaymentTransactionObserver {
//code
}

However, It keeps giving me the errors "Cannot find type 'SKPaymentTransactionObserver' in scope" and "Cannot find type 'SKProductsRequestDelegate' in scope". I think it has something to do with the implementation of StoreKit, but I am not sure. Additionally, the "SKProductsRequestDelegate" and "SKPaymentTransactionObserver" are greyed out (it does not turn purple like the "UIViewController" does). Does anyone know what to do?

Thanks in advance!


Solution

  • Update: I just had to move all my files to a new project, that worked for me.