sphero-inc / Sphero-iOS-SDK

🚫 DEPRECATED: Sphero™ is the amazing robotic ball ( sphero.com ) created by Orbotix, this is the repository for the iOS SDK for Sphero™. Visit dev site for more information:
http://sdk.sphero.com
225 stars 81 forks source link

RKStabilizationCommand and RKMacroObject in SDK 3.0.0-beta2 #21

Closed sodastsai closed 9 years ago

sodastsai commented 9 years ago

When playing an RKMacroObject with RKStabilizationCommand as one command, the app crashes and raises an exception -[RKStabilizationCommand getByteRepresentation]: unrecognized selector sent to instance.

RKMacroObject *macro = [[RKMacroObject alloc] init];
[macro addCommand:[RKStabilizationCommand commandWithState:RKStabilizationStateOn]];
RKMacroPlayer *player = [[RKMacroPlayer alloc] initWithRobot:self.robot.robot];
[player play:macro];

(where self.robot is an RKConvenienceRobot instance)

Anyway, it's okay to use

[self.robot sendCommand:[RKStabilizationCommand commandWithState:RKStabilizationStateOn]];

I'm using the new SDK (3.0.0-beta2)

iamcgn commented 9 years ago

Thanks again for the feedback! What you're describing works as expected. RKMacroObject only takes RKMacroCommand objects. RKStabilizationCommand is a robot control command not an instance of RKMacroCommand. You currently don't see a compiler warning if you pass the command in inline like your example above because we're returning id rather than instancetype. I will update the command classes to return instancetype so you get some compile time help in this situation.

sodastsai commented 9 years ago

Great, it's good to use compiler's features to keep developers away from typo and these type errors.

Thanks.

sodas http://about.me/sodastsai

On Feb 18, 2015, at 2:02 AM, Corey notifications@github.com wrote:

Thanks again for the feedback! What you're describing works as expected. RKMacroObject only takes RKMacroCommand objects. RKStabilizationCommand is a robot control command not an instance of RKMacroCommand. You currently don't see a compiler warning if you pass the command in inline like your example above because we're returning id rather than instancetype. I will update the command classes to return instancetype so you get some compile time help in this situation.

— Reply to this email directly or view it on GitHub.

zenelk commented 9 years ago

Added JIRA task for this: SDK-665

zenelk commented 9 years ago

This is updated in the Beta 3 release