小编jla*_*jla的帖子

构建错误 - 实例消息的接收器类型"ViewController"是前向声明

我在构建时遇到2个错误,它们位于AppDelegatem文件中

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

有两个错误的行:

self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
Run Code Online (Sandbox Code Playgroud)

ERROR1:

Receiver type "ViewController" for instance messages is a forward declaration
Run Code Online (Sandbox Code Playgroud)

误差2:

Receiver "ViewController" for class messages is a forward declaration
Run Code Online (Sandbox Code Playgroud)

警报线:

self.window.rootViewController = self.viewController;
Run Code Online (Sandbox Code Playgroud)

警报:

Incompatible pointer types assigning to 'UIViewController *' from 'ViewController*'
Run Code Online (Sandbox Code Playgroud)

如果需要,你可以找到ViewControllerm的文本文件ViewControllerh AppDelegatem这里 …

iphone compiler-errors ios5

1
推荐指数
1
解决办法
6648
查看次数

标签 统计

compiler-errors ×1

ios5 ×1

iphone ×1