objective-c - @interface : "expected identifier or {" and "Parse issue: Missing @end" 处的 appdelegate 错误

标签 objective-c ios uikit uiapplicationdelegate

我收到 appdelegate.h 的错误:“预期的标识符或 {”和“解析问题:缺少 @end”。

我已经尽我所能来解决这个问题。我检查了标题和#imports。我已经将所有类移到一个新项目中,认为build设置有问题。我什至重新安装了 Xcode 也无济于事。这是应用程序 delegate.h

#import <UIKit/UIKit.h>
#import "MainViewController.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate> {
    UIWindow *window;
    MainViewController *viewController;
    NSMutableArray *savedBookmarksArray;
}

@property (nonatomic) IBOutlet UIWindow *window;
@property (nonatomic) IBOutlet MainViewController *viewController;
@property (nonatomic) NSMutableArray *savedBookmarksArray;

@end

每个引用应用程序委托(delegate)的类都表示找不到该文件。 .m 包含在编译源中。有人知道如何解决这个问题吗?

主.m

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

MainViewController.h

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "DDWebView.h"

@class AboutTableViewController;

@interface MainViewController : UIViewController <UIActionSheetDelegate, UIAlertViewDelegate, UIWebViewDelegate, UIPopoverControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate> {


}

@end

最佳答案

我解决了这个问题。我在我的其他 header 之一中导入了 #import "AppDelegate" 而不是 #import "AppDelegate.h"

感谢大家的帮助! ..

关于objective-c - @interface : "expected identifier or {" and "Parse issue: Missing @end" 处的 appdelegate 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10498832/

相关文章:

iOS应用程序用户模拟和监控?

ios - 在多次删除行时删除 UITableView 上的行中的错误

swift - 使用多行 Swift 字符串构建多部分表单数据不起作用

cocoa-touch - 如何转到 UITextField 中的下一行?

ios5 - 将 UIDocument 移动到文件系统上的新位置的正确方法是什么

ios - 添加到 inputAccessoryView 的 UIButton 未检测到触摸

ios - 我希望能够使用 Storyboard 左右滚动 UITableViewCell。这不可能吗?

ios - 向 NSAttributedString 添加左边距的最佳方法是什么?

ios - 点击按钮后更改先前 View 的图像(Swift)

ios - 通过标题识别 UIAlertView,但不显示标题