“未解析的标识符”错误 SparkSetupMainController()”自定义粒子光子 Swift iOS 应用程序(标准粒子文档程序)

“Unresolved Identifier” error SparkSetupMainController()” custom Particle Photon Swift iOS app (Standard Particle documentation procedure)

你好,

我正在尝试将我的 Particle Photon 与自定义 Swift iOS 应用程序连接起来。我在 Swift 中编写代码并使用官方 Particle iOS 开发文档作为我的指导。 (https://docs.particle.io/guide/how-to-build-a-product/mobile-app/)

所有 SDK 都在我的 Xcode 项目中,随时可以使用。通过 CocoaPods 的 SDK 安装过程没有显示任何错误或问题。

我必须创建一个 UIButton (startDeviceSetup) 并添加一些代码(我认为)在 Particle 的 SDK 中请求函数。

Particle 在其文档中给出的代码:

@IBAction func startDeviceSetup(sender: AnyObject) { var setupController = SparkSetupMainController() self.presentViewController(setupController, animated: true, completion: nil) }

创建并连接我的 UIButton 并输入以下代码后。 Xcode 在尝试构建时出现未解析的标识符错误:

Unresolved Identifier error

互联网告诉我,“未解析的标识符”似乎是一个常见错误,通常与 Target 成员资格有关,或者 类 而不是 public。不幸的是,我无法弄清楚我的问题所在。我严格遵循 Particles 文档,没有做任何不同的事情。

附加信息

我正在使用 Xcode 8.0、iOS 10 和 Swift 3. 我使用 CocoaPods 安装了 Particles SDK。如官方粒子文档中所述。我在我的 main.storyboard 中创建了一个新的 UIButton 并将它作为一个动作连接到我的 ViewController 等

同样,像“导入 Spark-SDK”这样的导入也没有任何区别。

感谢您阅读我的问题, 我仍在寻找答案。如果有人能帮助我,我将不胜感激:)

不知何故 Xcode 自行修复。我刚刚重新安装了它。在我的 ViewController 中导入 Spark-SDK 和 SparkSetup 现在工作正常。

您需要创建从 swift 项目到 pods 文件的桥梁。换句话说你需要创建一个头文件