Apple's Image I/O programming guide says:
Image I/O resides in the Application Services framework in Mac OS X, and in the Image I/O framework in iOS. After adding the framework to your application, import the开发者_如何学C header file by including this statement:
#import <ImageIO/ImageIO.h>
I must be "adding the framework" wrong because when I add the #import line to my code and compile I get an error "ImageIO/ImageIO.h: No such file or directory". Can someone tell me what I'm doing wrong?
I did the following in Xcode to get the error.
- New Project (OS X Cocoa Application)
- In the "Groups & Files" tree select MyProjectName/Frameworks/Other Frameworks...
- Right click and select Add > Existing Frameworks
- Under "Mac OSX 10.6 SDK" in the dialog that appears, choose "ApplicationServices.framework"
- In MyProjectName.m (or any other file) add #import <ImageIO/ImageIO.h>
I'm using Xcode 3.2.3 on OS X 10.6.4 and have 10.6 SDK (10M2262).
I've also tried adding the framework using Project > Add to Project.. and choosing the framework from the SDK and from /System/Library/Frameworks and get the error in all cases.
You've added the framework correctly. What's causing your problem is that you shouldn't import ImageIO's header specifically; you should import the ApplicationServices header.
You may want to file a bug against the documentation.
I had a similiar experience, as I am still on XCode 3.2, in addition to what is said above, I had to use the Foundation tool template when creating a new project, so I suspect everything would have been good if I had added the Foundation framework to the make file.
But when stuff like this happens, then I drop into XCode, and tries to solve it from there.
精彩评论