iPhone CATextLayer (QuartzCore framework) linking issue
I have the following code:
CATextLayer *test = [CATextLayer layer];
test.string = summary;
test.wrapped = YES;
//test.truncationMode = kCATruncationEnd;
//test.alignmentMode = kCAAlignmentJustified;
test.frame = s;
[test drawInContext:开发者_开发知识库context];
I import the framework and link against it, however when it links I get the following error:
ld: warning: in /Users/ryansully/Desktop/AppName/Project/1/AppName/QuartzCore.framework/QuartzCore, missing required architecture i386 in file Undefined symbols:
"_OBJC_CLASS_$_CATextLayer", referenced from: objc-class-ref-to-CATextLayer in StoriesCell.o ld: symbol(s) not found collect2: ld returned 1 exit status
This is for an iOS project. I get this error in both XCode 3.2.3 and XCode 4 DP2.
I had the same issue. I resolved it by adding the framework somewhere in the project properties.
In the project properties (in the Project Navigator in the left of XCode interface, click on the project): Targets/[your project's name]/Build Phases/Link Binary With Librairies.
Then add QuartzCore.h (there is a "+" button at the bottom of the list).
Turns out XCode 4 is still buggy and can't add Frameworks appropriately. The issue was solved by opening the project in XCode 3, removing + readding the framework, then compiling.
精彩评论