GithubHelp home page GithubHelp logo

particle-iot / spark-sdk-ios Goto Github PK

View Code? Open in Web Editor NEW
52.0 59.0 33.0 2.31 MB

DEPRECATED Particle iOS Cloud SDK. Use -->

Home Page: https://github.com/particle-iot/particle-sdk-ios

License: Apache License 2.0

Ruby 0.63% Objective-C 99.21% Shell 0.16%
particle ios sdk iphone ipad spark cocoapods carthage

spark-sdk-ios's Introduction

Particle

Deprecated

Particle iOS Cloud SDK

Deprecation notice

This repository and the underlying Cocoapod & Carthage iOS libraries has been deprecated in favor of a renamed library (particle-sdk-ios) which can be found here. You can also follow the Cocoapod link. Or use Carthage by following instructions found here


spark-sdk-ios's People

Contributors

arslanbilal avatar idokleinman avatar jensck avatar mikekavouras avatar readmecritic avatar seigel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spark-sdk-ios's Issues

Document soft AP device command flow

Issue by towynlin
Thursday Jan 15, 2015 at 05:42 GMT
Originally opened as https://github.com/spark/mobile-sdk-ios/issues/41


I'm imagining this to simply be a code comment somewhere, but it could be in the README or another piece of documentation. It would help newcomers to the code get oriented if there were a list of the typical flow through soft AP in terms of the commands issued to the device.

From a conversation with @idokleinman, here's the current state of things:

device-id -> public-key -> set -> scan-ap -> configure-ap -> connect-ap

Capitalisation issue in pod spec

Hei,
pod 'Spark-SDK' does not work pod 'spark-sdk' does partially work but gives an issue with the Spark-SDK/Helpers dependency.

As a solution I forked the sdk and loaded it via

pod 'Spark-SDK', :git => '[email protected]:doozMen/spark-sdk-ios.git'

But that is only a temporary solution.

App crashes after customer names particle

We have encountered a customer who's iOS app repeatedly crashes after naming a trying to name a particle device. The particle backend knows this device is online, and it does not have a name. Names have been:

"doggy ADHD" (which had a space)
"Logic_dogs" (with no space)
random default of two words with an underscore

Customer says:
"But after I hit "OK" on that screen, the app crashes out to my main home screen."

Device is iOS 9.3.2.

Notably, the users photon is online, and they did get an OTA updating to v24 of our software. From our dashboard we see:

290048001047353138383138 none v24 [email protected] Jun 22nd 2016 at 4:00 pm

Interestingly, the name is "none" which seems consistent with the user reporting an error crashing immediately after attempting to name. It appears the "name" never got there. We keep track of errors via FailedPairingRecords, but we do not have any in this case, as the app has crashed before we get the error code back.

Myphoton value is always nil

i use your code
in for loop device name equal my spark core name and myPhoton=device but after for loop myPhoton value is always nil so led always off

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

__block SparkDevice *myPhoton;
[[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:@"ereneren55"])
            myPhoton = device;
    }
}];


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

Photon setup crash on “Check for internet connectivity”

After choose your own wifi network and input the password it goes into this page and crash on "Check for interest connectivity"

2 pic

What i do is just put these two lines into the button action:

       let setupController = SparkSetupMainController()
        self.presentViewController(setupController, animated: true, completion: nil)

log error is:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

Crashes failure in this function:
-(void)getDevices:(void (^)(NSArray *sparkDevices, NSError *error))completion
screen shot 2015-11-02 at 11 15 05 am

SDK: Mocks (cloud)

Issue by idokleinman
Wednesday Jan 14, 2015 at 02:49 GMT
Originally opened as https://github.com/spark/mobile-sdk-ios/issues/35


Build a node.js localhost simulated cloud server that responds successfully to all API endpoint calls and saves credentials, generates tokens, stores device IDs, etc.
Modify SparkCloud class so it can receive different endpoint address for dependency injection.
Add a test suite.
(low priority)
can also be used by Android, Phonegap. CC: @nexxy @jensck

Too Slow

For some reason, listing devices and/or getting a device thru the API seems too slow compared to a same request thru standard REST client. 2 seconds vs 10 or more. I will investigate further, but it seems like a ADNetworking issue.

Cannot import with Carthage

Getting a Could not build Objective-C module 'ParticleSDK' error on my import ParticleSDK line.
This also causes the #import "SparkEvent.h" line in SparkDevice.h file to throw the error 'SparkEvent.h file not found

Cartfile:

github "spark/spark-sdk-ios" ~> 0.4.1

Running $ carthage update --no-use-binaries --platform iOS.

Notes:

  • With no changes to the Cartfile or command, import AFNetworking throws no errors.
  • This error effects https://github.com/spark/spark-setup-ios. In other words, I cannot use that library with Carthage because it requires me to call SparkCloud in code, which requires me to have import ParticleSDK. But interestingly, import ParticleDeviceSetupLibrary throws no errors 👍

Documentation error

The docs have incorrect method signature for login function. Completion block is missing and this is resulting in build time issues in XCode

Calling function while subscribed to events results in timeout

I am using the latest release of the SDK, Version 0.3.4. For some reason, if my app subscribes to an event, I cannot seem to call functions (using callFunction)on my device. If I do not subscribe to the event, the function calls work perfectly and the completion block is called quickly as expected. When I subscribe to an event, the subscription works fine and my app receives events published from my device, however when I call a function, the call times out after about 20 seconds. The error info is below.

Has anyone experienced this? I haven't ruled out that it's something that I am doing wrong but I've been wrestling with this for a while and not making any progress. Are there any requirements about what thread you call callFunction from or subscribeToEventsWithPrefix()?

"Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x7f9b6420e930 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://api.particle.io/v1/devices/40002b000447343233323032/set-tc-temp, NSErrorFailingURLKey=https://api.particle.io/v1/devices/40002b000447343233323032/set-tc-temp, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=The request timed out.}}, NSErrorFailingURLStringKey=https://api.particle.io/v1/devices/40002b000447343233323032/set-tc-temp, NSErrorFailingURLKey=https://api.particle.io/v1/devices/40002b000447343233323032/set-tc-temp, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}">

From my Podfile.lock:

  • Spark-SDK (0.3.4):
    • Spark-SDK/Helpers (= 0.3.4)
    • Spark-SDK/SDK (= 0.3.4)
  • Spark-SDK/Helpers (0.3.4)
  • Spark-SDK/SDK (0.3.4):
    • AFNetworking (< 3.0.0)
    • Spark-SDK/Helpers

Documentation needs to be clearer about asynchronous events

I've spent some time playing with the SDK this weekend, and noticed an issue in the examples and the documentation.

In all of the examples and docs, things like this are done with blocks:

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

Usually followed by a device enumeration step:

__block SparkDevice *myPhoton;
[[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;
}

}];

The problem is these network operations are asynchronous and as soon as the login method is invoked, it can move on to the enumeration before that is completed. Similarly, anything done with myPhoton after the device enumeration may not work if that operation hasn't completed. Sometimes it works if the network is fast enough, sometimes it doesn't. It would be nice if this were clearer in the documentation or if there were an easy way to make this synchronous calls..

Thanks for the great work, this is pretty fun stuff!

How to use same device with multiple users ?

I have device which will be connected to a hardware to which 10 people need access to for example a coffee machine. How do i enable the access to all these 10 users in my app.

Note : I have not done any customizing, i am using the devices as it is and using the SparkCoud SDK.

Thanks,

Sending ["D7",1] does not light the LED

I am doing this in my iOS app:
let funcArgs = ["D7",1]
myPhoton!.callFunction("digitalwrite", withArguments: funcArgs) { (resultCode : NSNumber!, error : NSError!) -> Void in
print(resultCode)
if (error == nil) {
println("LED on D7 successfully turned on")
}
}
But the resultCode i am getting is -2 and no error. But for some reason the LED is not lighting. On the other hand when i am using the Tinker app it works perfectly.

Can some one please help.

Thanks,

Carthage iOS framework issue

I've followed the guidelines for using Carthage when creating a custom iOS app but encounter the following error when trying to generate .framework files.

$ carthage update --platform iOS --use-submodules --no-use-binaries
*** Fetching spark-sdk-ios
*** Checking out spark-sdk-ios at "appstore_tinker_v1.0"
*** xcodebuild output can be found in /var/folders/1d/yjtzzlj10b9g7109rsshw2tr0000gn/T/carthage-xcodebuild.QRmzUF.log
*** Skipped building spark-sdk-ios due to the error:
Dependency "spark-sdk-ios" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/spark/spark-sdk-ios/issues/new

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.