让人痛恨的xcode错误提示信息! 以及为什么不能将A.h文件 在B.h文件#import 而只能在B.m文件中#import呢?

 

在调试程序时,遇到如下两条信息:

Expected identifier

Expected ';' after method prototype

原因:A.h文件  在B.h文件#import 导致A.h文件报出如上错误提示,只要将声明文件写在B.m文件中即可解决上述问题。为什么?

B.h  文件

#import <UIKit/UIKit.h>
@interface WelcomeViewController : UIViewController

@end

B.m文件

#import "WelcomeViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "IndexViewController.h"
#import "InterfaceHelper.h"     //要引入的那个.h文件

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

@interface WelcomeViewController ()

@end

@implementation WelcomeViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    

    [self performSelector:@selector(GoToViewController) withObject:nil afterDelay:1]; //1秒后,进入应用程序的主界面
    
    [InterfaceHelper initInterfaceHelper];
    NSUserDefaults *configData = [NSUserDefaults standardUserDefaults];
    NSLog(@"%@",[configData objectForKey:@"initStart"]);

}

-(void)GoToViewController
{
    CATransition *animation = [CATransition animation];
    animation.delegate = self;
    animation.duration = 0.7 ;  // 动画持续时间(秒)
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    animation.type = kCATransitionFade;//淡入淡出效果
    [[self.view layer]addAnimation:animation forKey:@"animation"];
    
//    MainViewController *myMainViewController = [[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil];
//    [self.view addSubview:myMainViewController.view];
    
    if (iPhone5) {
       IndexViewController *myIndexViewController = [[IndexViewController alloc]initWithNibName:@"IndexViewController_ip5" bundle:nil];
        [self.view addSubview:myIndexViewController.view];
    }else{
       IndexViewController *myIndexViewController = [[IndexViewController alloc]initWithNibName:@"IndexViewController" bundle:nil];
        [self.view addSubview:myIndexViewController.view];
    }
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    return NO;
}

@end

 

 

 

 

 

posted @ 2013-05-25 20:23  ygm900  阅读(3900)  评论(0编辑  收藏  举报