• 让人痛恨的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
  • 相关阅读:
    LeetCode Find Duplicate File in System
    LeetCode 681. Next Closest Time
    LeetCode 678. Valid Parenthesis String
    LeetCode 616. Add Bold Tag in String
    LeetCode 639. Decode Ways II
    LeetCode 536. Construct Binary Tree from String
    LeetCode 539. Minimum Time Difference
    LeetCode 635. Design Log Storage System
    LeetCode Split Concatenated Strings
    LeetCode 696. Count Binary Substrings
  • 原文地址:https://www.cnblogs.com/ygm900/p/3099261.html
Copyright © 2020-2023  润新知