所以我试图在我的精灵套件游戏的应用程序购买实现,我在斯威夫特工作。我知道我需要在SKProductsRequestDelegate
和SKPaymentTransactionObserver
协议添加到我的GameScene
类,为了做到这一点,但是当我加入他们,我得到的错误:Swift:无法将SKProductsRequestDelegate协议添加到GameScene类中?
Type 'GameScene' does not conform to protocol 'SKProductsRequestDelegate'
和SKPaymentTransactionObserver
类似的错误。
我进口StoreKit
这里是我的代码:
import SpriteKit
import AVFoundation
import StoreKit
class GameScene: SKScene, SKPhysicsContactDelegate, SKProductsRequestDelegate, SKPaymentTransactionObserver {
我在做什么错?
声称一致性是不够的,你实际上必须实现协议所需的方法。我认为SKProductsRequestDelegate有一个子协议。但总而言之,你确定GameScene是应该处理商店交易的类吗?我更喜欢单独的类处理商店交易,没有别的。 – gnasher729
哪里可以找到协议的方法? – skyguy
查看标记为_Required_ [here]的方法(https://developer.apple.com/library/ios/documentation/StoreKit/Reference/SKProductsRequestDelegate/#//apple_ref/occ/intfm/SKProductsRequestDelegate/productsRequest:didReceiveResponse :) and [这里](https://developer.apple.com/library/ios/documentation/StoreKit/Reference/SKPaymentTransactionObserver_Protocol/) – 0x141E