我在iPad上使用拆分视图模板。
在我的MasterViewController中,代码:
NSBundle * bundle = [NSBundle mainBundle];很管用。
在我的DetailViewController中,同样的代码显示了一个错误?我进口了<UIKit/UIKit.h>。它知道NSBundle,但不知出于什么原因不认识mainBundle。
如果是这样就好了。能帮到我!

Missing "[" at start of message send expression
编辑
答案:
我忘了托架了。在一份案件陈述中。因此,请使用:
case 1:
{
//bla ...
}发布于 2011-12-18 12:07:33
如果声明了变量,则语句周围需要大括号,这只是简单的"C“语法。
固定:
switch (sender.row) {
case 1:
{
NSURL *movieURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"testclip" ofType:@"mov"]];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
}
}假设op就是这个意思,我将MoviePlayerController改为MPMoviePlayerController。我还添加了缺少的player变量。
发布于 2011-12-18 12:08:24
如果要声明新变量,则需要在大小写中添加大括号。
这段代码不会编译
case 1:
NSURL *foo;这将:
case 1:
{
NSURL *foo;
}https://stackoverflow.com/questions/8551514
复制相似问题