ios - 连接ViewController和场景来展示广告(SpriteKit)

标签 ios swift sprite-kit admob

所以我按照本教程展示了横幅广告 http://insaneplatypusgames.com/2016/03/29/adding-admob-banners-to-spritekit-games/

它提供的代码非常简单。我希望在我的应用程序开头的主菜单中添加广告。

我已经完成了最后一步,

// Linking view controller and scene to show ads
scene.ViewController = self

我收到一个错误:

Value of type MainMenuScene has no member 'ViewController' - Did you mean inutViewController? And I didn't mean inputViewController.

您可能需要更多信息,但我不确定是什么,所以我可以将其包括在内。

最佳答案

scene.viewController = self 不是 scene.ViewController = self

viewController 是 GameScene 中类型为 GameViewController 的成员变量。(根据您的教程)

关于ios - 连接ViewController和场景来展示广告(SpriteKit),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43160032/

相关文章:

ios - 当 JSON 以具有不同属性的多个数组为根时如何使用 Swift 4 Codable

ios - Realm 不查询带有空格的字符串字段

swift - 如何让 SKSprite 节点在游戏开始时自行左右移动?

ios - 如何从游戏场景中调用一个 Action

ios - 将字符串转换为 CLLocation 坐标

ios - 关闭消息 View Controller

swift - Apple 开发者 SwiftUI 教程的预览问题 - 与 UIKit 的框架集成接口(interface)

swift - 使用未解析的标识符 'sizeof'

ios - 地理编码和设置全局变量 iOS

ios - Swiftui:如何在导航标题上添加辅助功能标识符