Search code examples
iosswiftxcodeparticle-photon

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


Hello there,

I’m trying to connect my Particle Photon with a custom Swift iOS app. I’m writing code in Swift and use the official Particle iOS development documentation as my guidance. (https://docs.particle.io/guide/how-to-build-a-product/mobile-app/)

All the SDK’s are within my Xcode project and ready to be used. The SDK installation process via CocoaPods didn’t show any errors or ploblems.

I had to create an UIButton (startDeviceSetup) and added some code that (I think) asks for functions within Particle’s SDK.

Code given by Particle in their documentation:

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

After creating and connecting my UIButton and entering the following code. Xcode gives me an Unresolved Identifier error when I’m trying to make a build:

Unresolved Identifier error

The internet tells me that “Unresolved Identifier” seems to be a common error that often have something to do with Target memberships or classes that aren’t public. Unfortunately I can’t figure out the location of my problem. I strictly followed Particles documentation and did nothing different.

Additional information

I’m using Xcode 8.0, iOS 10 and Swift 3. I installed Particles SDK’s using CocoaPods. As described in the official Particle documentation. I created a new UIButton within my main.storyboard and connected it as an action to my ViewController etc.

Also Imports like this “import Spark-SDK” didn't make any difference.


Solution

  • Somehow Xcode fixed itself. I just reinstalled it. Importing Spark-SDK and SparkSetup in my ViewController works fine now.