Sphereo构建在Xcode4上失败

Sphereo构建在Xcode4上失败,xcode4,sphero-api,Xcode4,Sphero Api,我正在尝试为“Sphero”创建IOS应用程序,我想测试HelloWorld示例,但是在创建新项目后,我单击了build,但它失败了,我遇到了4个问题: 1) 使用af未声明的标识符“viewDidLoad”: -(void)viewDidLoad { 2) 消息发送表达式开头缺少“[” 这在下面的代码行中,xcode希望在第二个“选择器”前面加上[in] 3) 错误的接收器类型'SEL'(与上述同一行) 4) 预期对外申报: 最后一个花括号出现错误 -(void)viewDidLoad {

我正在尝试为“
Sphero
”创建IOS应用程序,我想测试
HelloWorld
示例,但是在创建新项目后,我单击了build,但它失败了,我遇到了4个问题:

1) 使用af未声明的标识符“
viewDidLoad
”:

 -(void)viewDidLoad {
2) 消息发送表达式开头缺少
“[”
这在下面的代码行中,xcode希望在第二个“选择器”前面加上[in]

3) 错误的接收器类型
'SEL'
(与上述同一行)

4) 预期对外申报:

最后一个花括号出现错误

-(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
-(void)viewDidLoad {
    [super viewDidLoad];

    /*Register for application lifecycle notifications so we known when to connect and disconnect from the robot*/
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];

    /*Only start the blinking loop when the view loads*/
    robotOnline = NO;

    calibrateHandler = [[RUICalibrateGestureHandler alloc] initWithView:self.view];
}

}

用这个替换你的代码

-(void)viewDidLoad {
    [super viewDidLoad];

    /*Register for application lifecycle notifications so we known when to connect and disconnect from the robot*/
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];

    /*Only start the blinking loop when the view loads*/
    robotOnline = NO;

    calibrateHandler = [[RUICalibrateGestureHandler alloc] initWithView:self.view];
}
试试这个
-(void)viewDidLoad {
    [super viewDidLoad];

    /*Register for application lifecycle notifications so we known when to connect and disconnect from the robot*/
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];

    /*Only start the blinking loop when the view loads*/
    robotOnline = NO;

    calibrateHandler = [[RUICalibrateGestureHandler alloc] initWithView:self.view];
}