我收到 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/