当我使用我的主视图时,在我的appdelegate中获取错误将其声明为全局

时间:2010-03-20 06:21:09

标签: objective-c

我在这里遇到几个小时的问题。

我的问题是

这是我在appdelegate didFinishLaunching方法中的代码。

#import "CorkItAppDelegate.h"


@implementation CorkItAppDelegate

@synthesize   window,isPicker,isFirstTime,winTyp,winTypId,wineCatName,wineRegName,theViewController,catId,regId,facebookObject,isGetWineName,getNewWineName,isNewWine,getNewWineReg,isNewReg,wineDetPk,currentLocation,internetConnectionStatus;
static NSString* mapCurrentLocationUrlArg = @"http://maps.google.com/maps?q=%s@";

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

   // Override point for customization after application launch
    //facebookObject=[[FacebookMyLib alloc]init];
 [self createEditableCopyOfDatabaseIfNeeded];
 [self initializeDataStructures];

 [MyCLController sharedInstance].delegate = self;
 [[MyCLController sharedInstance].locationManager startUpdatingLocation];
 isGetWineName = NO;
 facebookObject = [[FacebookMyLib alloc] init];
 theViewController = [[[MasterViewController alloc] init]autorelease];
 UINavigationController* controller = [[UINavigationController alloc]     initWithRootViewController:theViewController];
 controller.navigationBar.barStyle = UIBarStyleBlackOpaque;
 [window addSubview:controller.view];
 [window makeKeyAndVisible];

}

在这段代码中,我在.h类中全局声明了MasterView控制器。它写了属性并为此合成。 但是当我运行构建时,我在#import“MasterViewController.h”中遇到两个错误,如

error:expected specifier-qualifier-list before 'MasterViewController.h'.

我遇到了两个错误: 在我的MasterViewController.m中 错误在#import“MasterViewController.h”

处理
#import "MasterViewController.h"
//here I am getting 2 error:expected specifier-qualifier-list before 'MasterViewController.h'.

#import "CorkItAppDelegate.h"
#import"InfoViewController.h"

@implementation MasterViewController

CorkItAppDelegate.h中的代码是:

#import <UIKit/UIKit.h>
#import <sqlite3.h>
#import "wineDetails.h"
#import "wineTypes.h"
#import "WineCategoriesList.h"
#import "MyCLController.h";
#import "Reachability.h";
#import "WineRegion.h"
#import "EventsList.h"
#import"FBConnect/FBConnect.h"
#import"FacebookMyLib.h"
#import "MasterViewController.h"

@interface CorkItAppDelegate : NSObject <UIApplicationDelegate,MyCLControllerDelegate> {

    MasterViewController* theViewController ;
    UIWindow *window;
    sqlite3 *database;
    NSMutableArray* masterViewList;
}
@property(nonatomic,retain)MasterViewController* theViewController ;

@end

任何人都可以建议我如何摆脱这个。

任何人的帮助都会得到很多赞赏。

谢谢你, Monish。

1 个答案:

答案 0 :(得分:0)

删除除了

之类的sdk标题以外的所有标题
remove:
#import "wineDetails.h"
#import "wineTypes.h"
#import "WineCategoriesList.h"
#import "MyCLController.h";
#import "Reachability.h";
#import "WineRegion.h"
#import "EventsList.h"
#import"FacebookMyLib.h"
#import "MasterViewController.h"

Don't remove :
#import <UIKit/UIKit.h>
#import <sqlite3.h>
#import"FBConnect/FBConnect.h"

希望这有帮助