【问题标题】:Cannot find type 'SKPaymentTransactionObserver' in scope在范围内找不到类型“SKPaymentTransactionObserver”
【发布时间】:2021-11-29 19:57:47
【问题描述】:

我正在尝试为我的应用实施应用内购买。

import StoreKit
import UIKit

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

但是,它一直给我错误“在范围内找不到类型 'SKPaymentTransactionObserver'”和“在范围内找不到类型 'SKProductsRequestDelegate'”。我认为这与 StoreKit 的实现有关,但我不确定。此外,“SKProductsRequestDelegate”和“SKPaymentTransactionObserver”是灰色的(它不会像“UIViewController”那样变成紫色)。有谁知道该怎么做?

提前致谢!

【问题讨论】:

  • 无法复制。您可能需要通过删除派生数据或其他东西来拍 Xcode 的头。
  • 你有付费的苹果开发者计划吗?如果您使用免费的 Apple Developer 帐户,storeKit 将无法使用。

标签: swift xcode error-handling in-app-purchase


【解决方案1】:

更新:我只需将所有文件移动到一个对我有用的新项目中。

【讨论】:

    猜你喜欢
    • 2021-09-24
    • 2021-09-21
    • 2021-08-01
    • 2022-01-16
    • 2021-08-03
    • 2021-09-23
    • 1970-01-01
    • 1970-01-01
    • 2023-01-26
    相关资源
    最近更新 更多