Question

I'm trying to connect a Sphero to a Cocos2d game I'm building. Sphero has some good documentation and examples, and I can run the sample code. I started with a cocos2d project and added the Sphero frameworks. I am not able to get a basic command to the ball. I believe the issue is in this function:

-(void)setupRobotConnection 
{
    /*Try to connect to the robot*/
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRobotOnline) name:RKDeviceConnectionOnlineNotification object:nil];

    if ([[RKRobotProvider sharedRobotProvider] isRobotUnderControl]) 
         [[RKRobotProvider sharedRobotProvider] openRobotConnection];        

}

(The rest of the code is at the link) I believe that it has something to do with the NSNotificationCenter. I am calling this code from a CCLayerColor, rather than a UIViewController like the demo does. I get this error:

2012-08-25 01:54:19.738 bgmmo[1414:2d07] ERROR - opening session failed as protocol com.orbotix.robotprotocol is not declared in Info.plist

(This was answered in the Sphero IOS Forum)

Était-ce utile?

La solution

You need to add the external accessory protocol string to your Info.plist. Edit the Info.plist for you application target and add a entry for key "Supported external accessory protocols" which will create an array enter. Add "com.orbotix.robotprotocol" as a String item in the array.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top