iOS SDK digitalWrite not working [Photon]

Hello,

I had this issue before, but now with the new transition of SparkDevice to ParticleDevice, I am facing the same problem again. DigitalWrite doesn’t seem to work even following the documentation.
Documentation >>> iOS SDK | Reference Documentation | Particle

This is my code:

ParticleCloud.sharedInstance().login(withUser: userName, password: password) { (error:Error?) -> Void in
                    if let _ = error {
                        print("Wrong credentials or no internet connectivity, please try again")
                    }
                    else {
                        print("Logged in")
                        var myPhoton : ParticleDevice?
                        ParticleCloud.sharedInstance().getDevices { (devices:[ParticleDevice]?, error:Error?) -> Void in
                            if let _ = error {
                                print("Check your internet connectivity")
                            }
                            else {
                                if let d = devices {
                                    for device in d {
                                        myPhoton = device
                                        print(myPhoton!)
                                        let funcArgs = ["D7,HIGH"] as [Any]
                                        _ = myPhoton?.callFunction("digitalWrite", withArguments: funcArgs) { (resultCode : NSNumber?, error : Error?) -> Void in
                                            if (error == nil) {
                                                print("LED on D7 successfully turned on")
                                            } else {
                                                print("Error! \(String(describing: error))")
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

What am I doing wrong?

PS: Is there a github of an example app for swift. The current example file downloaded has only the particle setup code.

Thanks.

We don’t know which firmware you are running on your devices but in Tinker the function is actually called digitalwrite with a lower case w.

Hello,

I tried the digitalwrite but still no luck. I do not know what version i’m using to be honest. But the error I get is:

Optional(Error Domain=ParticleAPIError Code=400 “Timed out.” UserInfo={io.particle.error.localizedstring=Timed out., io.particle.error.response.body={

error = “Timed out.”;

ok = 0;

}, NSLocalizedDescription=Timed out.})

EDIT:
The device OS target (web IDE) is set to 2.0.1

I just assumed you are running Tinker, but you haven’t really told us what code you are running in your Particle.function()?
The cloud expects the return value to be sent back rather swiftly (~3sec) and if it doesn’t turn up by then (e.g. due to some delays in your function) it will report a timeout.

Have you tested your firmware with Console or CLI?

It works through the IDE and also the application. I am using the documentation to call a function written by code to the Photon. There is no function that is stored in or written other than the one mentioned above. I am running this through XCODE in Swift language.