问题描述
我正在尝试使用CoreText中的CTFontCreateWithNameAndOptions()
,并且链接器在说找不到符号",特别是对于_CTFontCreateWithNameAndOptions
.我添加了CoreText.framework并正在导入< CoreText/CoreText.h>.编译正常,但链接器失败.
I am trying to use CTFontCreateWithNameAndOptions()
from CoreText and the linker is saying "Symbol(s) not found", specifically for _CTFontCreateWithNameAndOptions
. I added CoreText.framework and am importing <CoreText/CoreText.h>. It compiles fine, but the linker fails.
这是CTFont.h中的声明:
Here's the declaration in CTFont.h:
CTFontRef CTFontCreateWithNameAndOptions( CFStringRef name, CGFloat size, const CGAffineTransform *matrix, CTFontOptions options ) CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2);
CTFontRef CTFontCreateWithNameAndOptions( CFStringRef name, CGFloat size, const CGAffineTransform *matrix, CTFontOptions options ) CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2);
这是实际电话:
CTFontRef font = CTFontCreateWithNameAndOptions( (CFStringRef)@"HelveticaNeue-Bold" , 14.0f , NULL , kCTFontOptionsDefault ) ;
CTFontRef font = CTFontCreateWithNameAndOptions( (CFStringRef)@"HelveticaNeue-Bold" , 14.0f , NULL , kCTFontOptionsDefault ) ;
有人有什么主意吗?
我的iOS应用正在针对4.2框架进行链接.
My iOS app is linking against the 4.2 framework.
推荐答案
我遇到了同样的问题. _CTFontCreateWithNameAndOptions不是iOS的CoreText框架的一部分,它仅是OS X的CoreText框架的一部分.我报告了一个文档错误.
I had the same problem. _CTFontCreateWithNameAndOptions is not part of the CoreText framework for iOS, it is part of CoreText framework for OS X only. I reported a documentation bug.
这篇关于链接器找不到CTFontCreateWithNameAndOptions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!