我在试着把斯皮罗和我正在开发的Cocos2d游戏联系起来。Sphero有一些很好的documentation和示例,我可以运行示例代码。我从一个cocos2d项目开始,并添加了Sphero框架。我不能掌握球的基本指令。我认为问题出在这个函数中:
-(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];
}(代码的其余部分在链接中)我相信它与NSNotificationCenter有关。我从CCLayerColor调用这段代码,而不是像演示那样从UIViewController调用。我得到了这个错误:
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(此问题已在Sphero IOS Forum中得到回答)
发布于 2012-08-28 03:15:12
您需要将外部附件协议字符串添加到您的Info.plist。编辑应用程序目标的Info.plist,并为关键的“受支持的外部附件协议”添加一个条目,这将创建一个数组enter。将"com.orbotix.robotprotocol“作为字符串项添加到数组中。
https://stackoverflow.com/questions/12137681
复制相似问题