【问题标题】:Why is my HelloWorld program not compiling?为什么我的 HelloWorld 程序无法编译?
【发布时间】:2011-10-12 15:45:36
【问题描述】:

我一直在关注关于如何使用 xcode4 和 Objective C 创建一个基本的 iphone 应用程序的 HelloWorld 教程。当我尝试从一个自动化类中运行它时,我并没有完全触及它。看到所有错误都在一个我没有编辑过的复杂类中,我完全不知道出了什么问题。我在某个时候不小心在其中输入了一些内容,但立即撤消了它。

Warning: incomplete implementation
Error: Property Implementation must have it's declaration in interface "HelloWorldAppDelegate"
Error: No declaration of property 'window' found in interface
Warning: method definition for changeTheTextOnLabel not found


#import "HelloWorldAppDelegate.h"

#import "HelloWorldViewController.h"

@implementation HelloWorldAppDelegate


@synthesize window=_window;

@synthesize viewController=_viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{

}

- (void)applicationDidEnterBackground:(UIApplication *)application
{

}

- (void)applicationWillEnterForeground:(UIApplication *)application
{

}

- (void)applicationDidBecomeActive:(UIApplication *)application
{

}

- (void)applicationWillTerminate:(UIApplication *)application
{

}

- (void)dealloc
{
    [_window release];
    [_viewController release];
    [super dealloc];
}

@end

【问题讨论】:

  • 听起来您的界面不包含window 属性。
  • @George:回答这个问题,因为它是对的。

标签: iphone objective-c xcode delegates


【解决方案1】:

确保在您的 HelloWorldAppDelegate.h 文件中出现

@property (nonatomic, retain) IBOutlet UIWindow *window;

我还会在您的 .XIB 文件中仔细检查窗口插座是否已连接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-30
    • 1970-01-01
    相关资源
    最近更新 更多