I a new to Objective C and iphone development. I read somewhere that I need to import the header files of foundation framework in my files where I want to use them. But I saw a sample Iphone project which was using NSString, NSDate, NSArray
etc but there was never a statement like #import Foundation.h
or #import NSString.h
or so.
The import was probably in a prefix header . Prefix headers get added to the top of every file that gets compiled.
look at the supporting files there will be a file yourprojectname-Prefix.pch open that up..
there you will se something like...
//
// 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
this is automatically added to your file.
您是否查看过Prefix.pch
中“ Supporting files”文件夹中的Prefix.pch
文件?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.