New Particle iPhone app IOS 8.0+ only?

It says on the app store that only IOS 8.0 or later is supported.

Are there plans to add support for previous versions of IOS in the near future.?

Are there any alternative/older apps available for iPhone & Photon?

You should look for Blynk. I supported it on kickstarter. It’s out now. Works with Spark.
I haven’t tried it yet but you should :slight_smile: :smile:

https://www.kickstarter.com/projects/167134865/blynk-build-an-app-for-your-arduino-project-in-5-m

@ruben
thanks for the suggestion. i had seen that campaign & will check it out again once the photons land.
Am still interested to find out about future plans for IOS version support on the inhouse IOS Particle app.

Hello @AnalysIR!

Indeed the Particle app (which allows user device management + device setup + coming soon: Tinker ) is an iOS 8+ app, we currently have no plans to support earlier version of iOS, as Apple themselves ended support for non-iOS 8 devices.

Is there any particular reason why you cannot update your phone to iOS8?

Thanks for the response. :slight_smile: & :frowning:

There are only x hundred reasons why. I don’t usually throw them out, when they work perfectly fine or can be easily repaired for a few $.

In the meantime, I have figured out a way to get access to a new iPad for testing, but it will be a while until I get to use the app on a day to day basis with iPhone.

I assume from your reply, that there are no other ‘officially supported’ iPhone apps that would work with Photon. (excluding 3rd party apps)

Here is some Swift code that will read a spark.variable. Just insert your own device ID, access token and variable name. This code was attached to a button named updateSparkButton. Sorry, you have to know a bit about creating an IOS app to make use of this code, but if you do, then this code will access your Core and read the variable.

@IBAction func updateSparkButton(sender: AnyObject) {
    println("Button light pressed")
    let url = NSURL(string: "https://api.spark.io/v1/devices/your_Device_ID/yourSpark.variable?access_token=your_access_token")
    let session = NSURLSession.sharedSession()
    let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in
        if error != nil {
            println(error)
        } else {
            //println(data)
            let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary
            //println(jsonResult["result"])  the data is now in a dictionary.  Refer to the name to get the data.  Easy
            var lightLevel = jsonResult["result"] as? NSNumber
            var lightLevelInt:Int = lightLevel! as Int
            dispatch_async(dispatch_get_main_queue()) {  // dispatch forces this que to run without dealay
                 self.sparkLightLabel.text = String(lightLevelInt)
                }
        }
    })
    task.resume()
}

for more help on the format of the url call to the cloud, see the cloud API docs. If you want to see the JSON response from the cloud, just paste the url line (with your device ID, access token and variable name) into a browser url and hit enter.

Sadly, it is not possible to execute a Spark.function with a simple url line, as it is to get a variable JSON response.

1 Like

Hi

All of this headache could be saved if you would use the Particle mobile SDK for iOS. You can get variables, call functions on the device, login to the cloud. Each operation requires just 1 line of code. You don’t have to worry about access tokens, SDK takes care of that.
It’s very easy to integrate using cocoa pods and supports swift language projects too.

Here’s the reference:

Thank you both for the suggestions. We will likely write our own apps down the road, but in the meantime I will play with IOS8 only and continue evaluating Photon as a potential platform…once it arrives.

Interesting article on IOS version stats http://david-smith.org/iosversionstats/
…first one i came across via google…

Short summary :

  • 25.5% not on IOS8
  • 20.6% on IOS7
  • 74.5% on IOS8

Hi @ido. I looked at the SDK for IOS and saw lots of documentation written for people who already know what they are doing :smile: The code I added is all you need if you just want to read some variables. While the SDK may have some simpler methods, the problem is installing it and learning how to use it. As the note says at the head of the page, documents coming… In the mean time one has to " check out the reference in Cocoadocs" or “consult the javadoc style comments”.

:wink:

The reference in the Cocoadocs website shows how hard you guys worked on the SDK. There is lots to learn. I did see reference to Access Tokens so I’m not sure how “the SDK takes care of that”. Don’t I still have to provide one?

This level of documentation is great for experienced coders but is tough for those less so, and I am one. If, in addition to the references, you provided simple (one concept) example code, in a sequential flow that got an IOS developer doing the most basic read/write of a core, that would bridge the gulf between us.

Honestly, looking at the reference docs provided, I have absolutely no idea where to start. I may represent the lowest class of competence of your customer base, but my experience designing, documenting, manufacturing and selling personal computer based test and measurement equipment through the 80s and 90s gives me the credibility to say that finding a way to nurture the ignorant (not stupid) customers is a road to riches.

I don’t know anything about @AnalysIR, but it sounds like he is interested in using Particle as a basis for some product. How big a design win could it be? Who knows. I can say from experience that once a customer learns how to be successful with a competitor’s product, you’re cooked. He’s not coming back.

Hi Bendrix, here are a couple of common and simple usage examples for the Particle iOS Cloud SDK to get you started:

Logging in to Particle cloud:

Objective-C

[[SparkCloud sharedInstance] loginWithUser:@"ido@particle.io" password:@"userpass" completion:^(NSError *error) {
    if (!error) 
        NSLog(@"Logged in to cloud");
    else 
        NSLog(@"Wrong credentials or no internet connectivity, please try again");
}];

Swift

SparkCloud.sharedInstance().loginWithUser("ido@particle.io", password: "userpass") { (error:NSError!) -> Void in
    if let e=error {
        println("Wrong credentials or no internet connectivity, please try again")
    }
    else {
        println("Logged in")
    }
}

Get a list of all current user devices and search for a specific device by name:

Objective-C

[[SparkCloud sharedInstance] getDevices:^(NSArray *sparkDevices, NSError *error) {
    NSLog(@"%@",sparkDevices.description); // print all devices claimed to user

    for (SparkDevice *device in sparkDevices)
    {
        if ([device.name isEqualToString:@"myNewPhotonName"])
            myPhoton = device;
    }
}];

Swift

var myPhoton : SparkDevice?
SparkCloud.sharedInstance().getDevices { (sparkDevices:[AnyObject]!, error:NSError!) -> Void in
    if let e = error {
        println("Check your internet connectivity")
    }
    else {
        if let devices = sparkDevices as? [SparkDevice] {
            for device in devices {
                if device.name == "myNewPhotonName" {
                    myPhoton = device
                }
            }
        }
    }
}

Read a variable from a Particle device (Core/Photon)

Assuming here that myPhoton is an active instance of SparkDevice class which represents a device claimed to current user:

Objective-C

[myPhoton getVariable:@"temperature" completion:^(id result, NSError *error) {
    if (!error) {
        NSNumber *temperatureReading = (NSNumber *)result;
        NSLog(@"Room temperature is %f degrees",temperatureReading.floatValue);
    }
    else {
        NSLog(@"Failed reading temperature from Photon device");
    }
}];

Swift

myPhoton!.getVariable("temperature", completion: { (result:AnyObject!, error:NSError!) -> Void in
    if let e=error {
        println("Failed reading temperature from device")
    }
    else {
        if let res = result as? Float {
            println("Room temperature is \(res) degrees")
        }
    }
})

Call a function on a Particle device (Core/Photon):

Objective-C

[myPhoton callFunction:@"digitalwrite" withArguments:@[@"D7",@1] completion:^(NSNumber *resultCode, NSError *error) {
    if (!error)
    {
        NSLog(@"LED on D7 successfully turned on");
    }
}];

Swift

let funcArgs = ["D7",1]
myPhoton!.callFunction("digitalwrite", withArguments: funcArgs) { (resultCode : NSNumber!, error : NSError!) -> Void in
    if (error == nil) {
        println("LED on D7 successfully turned on")
    }
}

Get a list of a specific device exposed functions and variables:

Objective-C

NSDictionary *myDeviceVariables = myPhoton!.variables;
NSLog(@"MyDevice first Variable is called %@ and is from type %@", myDeviceVariables.allKeys[0], myDeviceVariables.allValues[0]);

NSArray *myDeviceFunctions = myPhoton!.functions;
NSLog(@"MyDevice first Function is called %@", myDeviceFunctions[0]);

Swift

let myDeviceVariables : Dictionary? = myPhoton.variables as? Dictionary<String,String>
println("MyDevice first Variable is called \(myDeviceVariables!.keys.first) and is from type \(myDeviceVariables?.values.first)")

let myDeviceFunction = myPhoton.functions
println("MyDevice first function is called \(myDeviceFunction!.first)")

Get an instance of specific device by its ID:

Objective-C

    __block SparkDevice *myOtherDevice;
    NSString *deviceID = @"53fa73265066544b16208184";
    [[SparkCloud sharedInstance] getDevice:deviceID completion:^(SparkDevice *device, NSError *error) {
        if (!error)
            myOtherDevice = device;
    }];

Swift

var myOtherDevice : SparkDevice? = nil
    SparkCloud.sharedInstance().getDevice("53fa73265066544b16208184", completion: { (device:SparkDevice!, error:NSError!) -> Void in
        if let d = device {
            myOtherDevice = d
        }
    })

Rename a device:

Objective-C

myPhoton.name = @"myNewDeviceName";

or

[myPhoton rename:@"myNewDeviecName" completion:^(NSError *error) {
    if (!error)
        NSLog(@"Device renamed successfully");
}];

Swift

myPhoton!.name = "myNewDeviceName"

or

myPhoton!.rename("myNewDeviceName", completion: { (error:NSError!) -> Void in
    if (error == nil) {
        println("Device successfully renamed")
    }
})

Logout and clear user session:

Objective-C

[[SparkCloud sharedInstance] logout];

Swift

SparkCloud.sharedInstance().logout()

Good luck!

2 Likes

Got the instal done. See tutorials on Mobil forum. Ran the example code above. Very smooth and simple to use. Example for list of specific devices has problems due to change in swift compiler typing since it was written. Won’t compile as written above. Easy to fix though.

Thanks,

Ben

Some statistics on Swift adoption.

Swift: Last, there is the curious case of Swift. During our last rankings, Swift was listed as the language to watch – an obvious choice given its status as the Apple-anointed successor to the #10 language on our list, Objective-C. Being officially sanctioned as the future standard for iOS applications everywhere was obviously going to lead to growth. As was said during the Q3 rankings which marked its debut, “Swift is a language that is going to be a lot more popular, and very soon.” Even so, the growth that Swift experienced is essentially unprecedented in the history of these rankings. When we see dramatic growth from a language it typically has jumped somewhere between 5 and 10 spots, and the closer the language gets to the Top 20 or within it, the more difficult growth is to come by. And yet Swift has gone from our 68th ranked language during Q3 to number 22 this quarter, a jump of 46 spots. From its position far down on the board, Swift now finds itself one spot behind Coffeescript and just ahead of Lua. As the plot suggests, Swift’s growth is more obvious on StackOverflow than GitHub, where the most active Swift repositories are either educational or infrastructure in nature, but even so the growth has been remarkable. Given this dramatic ascension, it seems reasonable to expect that the Q3 rankings this year will see Swift as a Top 20 language.

I’ve heard rumors that Apple will discontinue any new work with Objective C soon, and will stop supporting it in three years or less. Also, that very little NEW IOS or OS X development is going on in ObC. More and more, companies consider it a status symbol to be able to say…

I have an iPhone 4, so cannot update to iOS8, even if I wanted to. I even downloaded an Android emulator for my Mac in desperation, but using that the Particle app couldn’t find my devices…

What with this and my issues installing particle-cli (currently trying to solve this is another thread), my two particles aren’t even any use as paperweights - they’re too light!

So much for user-friendliness…

sigh :unamused:

If you’ve got a serial program, you can manage the credentials over serial. Would you be willing to give that a try for the time being?
If you’ve got Putty (or something similar), put your device in listening mode, and press ‘W’. that should guide you through the process.

1 Like

Many thanks Moors! Didn’t realise this; I’m now connected. :slight_smile: