我是Objective C和iphone开发的新手。我在某个地方读到,我需要在我想使用它们的文件中导入基础框架的头文件。但我看到一个示例Iphone项目使用了NSString, NSDate, NSArray
等,但从来没有#import Foundation.h
或#import NSString.h
之类的语句
查看支持文件中会有一个文件yourprojectname-Prefix。PCH打开…
在那里你会看到像…
//
// Prefix header for all source files of the 'yourProject' target in the 'yourProject' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
导入可能在前缀头中。前缀头被添加到编译的每个文件的顶部。
您是否查看了项目中"支持文件"文件夹中的Prefix.pch
文件?