我正在尝试为“ Sphero
”创建一个用于 IOS 的应用程序,并且我想测试该HelloWorld
示例,但是在创建一个新项目后,我单击了构建,但它失败了,我遇到了 4 个问题:
1)使用未声明的标识符' viewDidLoad
':
-(void)viewDidLoad {
2) 在消息发送表达式开始时缺少"["
这是在以下代码行中,xcode 想要将 [ 放在第二个“选择器”之前
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
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];
}
}