Invoke function through device ID or particle access token [iOS-SDK]

In the reference guide [https://docs.particle.io/reference/ios/], I can only access an account which holds the devices, which then will allow me to invoke a function. Is it possible or only invoke a function without logging in, but using the Particle Access Token or Device ID?

Thanks.

PS: I am coding using Swift not Objective-C

I think, logging in with credentials is merely to get an accesstoken, which is then used for further communication. As such, you should be able to inject an accesstoken yourself, as is described in the reference section: “injectSessionAccessToken”. Give that a shot? (No guarantees, I’m not an iOS developer, but that’s how I do it in javascript as well.)

1 Like

You were correct! Here is is the code incase someone needs it in the near future too:

var myPhoton : ParticleDevice?
ParticleCloud.sharedInstance().getDevice("[insert device ID as string here]") { (device:ParticleDevice?, error:Error?) -> Void in
            if let _ = error {
                print("Invalid device ID")
            } else {
                print("device ID found!")
                myPhoton = device
            }
}```
1 Like