Three20 - [TTStyledLinkNode findLastSibling:]:发送到实例的无法识别的选择器

问题描述:

我使用ttmodule.py在Xcode 4.1(Build 4B110)中添加了three20到我的项目。只需导入并使用某些功能,Everywhere就可以了。Three20 - [TTStyledLinkNode findLastSibling:]:发送到实例的无法识别的选择器

然后我得到一个错误SIGABRT和崩溃当我使用TTStyledTextLabel这样的:

NSString* kText = @"<a href=\"http://www.google.com\">Google</a>"; 
    TTStyledTextLabel* label = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(0, 0, 200, 1)] autorelease]; 
    label.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES]; 
    [self.view addSubview:label]; 

和控制台错误信息:

-[TTStyledLinkNode findLastSibling:]: unrecognized selector sent to instance 0x5e830a0 
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TTStyledLinkNode findLastSibling:]: unrecognized selector sent to instance 0x5e830a0' 
    *** Call stack at first throw: 
    (
    0 CoreFoundation      0x0192a5a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x01a7e313 objc_exception_throw + 44 
    2 CoreFoundation      0x0192c0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x0189b966 ___forwarding___ + 966 
    4 CoreFoundation      0x0189b522 _CF_forwarding_prep_0 + 50 
    5 Xxxxxxxxx       0x000fc922 -[TTStyledElement addChild:] + 148 
    6 Xxxxxxxxx       0x0010584d -[TTStyledTextParser addNode:] + 176 
    7 Xxxxxxxxx       0x00105ca8 -[TTStyledTextParser parseURLs:] + 479 
    8 Xxxxxxxxx       0x00106b5c -[TTStyledTextParser parseText:URLs:] + 55 
    9 Xxxxxxxxx       0x00106f30 -[TTStyledTextParser parseText:] + 595 
    10 Xxxxxxxxx       0x00105a85 -[TTStyledTextParser flushCharacters] + 104 
    11 Xxxxxxxxx       0x0010690e -[TTStyledTextParser parser:didEndElement:namespaceURI:qualifiedName:] + 36 
    12 Foundation       0x01657959 _endElementNs + 453 
    13 libxml2.2.dylib      0x01dc67c7 xmlParseXMLDecl + 1346 
    14 libxml2.2.dylib      0x01dd14d1 xmlParseChunk + 3984 
    15 Foundation       0x0165715a -[NSXMLParser parse] + 321 
    16 Xxxxxxxxx       0x00106cd6 -[TTStyledTextParser parseXHTML:] + 256 
    17 Xxxxxxxxx       0x001039bb +[TTStyledText textFromXHTML:lineBreaks:URLs:] + 195 
    18 Xxxxxxxxx       0x000038fa -[Xxxxxxxxx someMethod] + 2282 

有Three20的错误吗?我不知道这一点。

+0

我认为真正的问题是Three20的分类方法不起作用。 – qiz 2012-02-06 10:11:40

做其他链接器标志包含-ObjC

正如您已经提到过,它看起来好像类别没有正确链接。最常见的原因是不指定-ObjC作为链接器标志。或者使用-Objc出事,就像我之前做过的那样。

如果您已有-ObjC您可能会尝试将-all_load添加到其他链接器标志,但是对于最新版本的Xcode或Three20,这不应该是必需的。

+0

我已经将** - ObjC **和** - all_load **添加到其他链接器标志,但问题仍然存在。 – qiz 2012-02-08 04:17:05

+0

最后,我将所有Three20的文件添加到我的项目中(而不是复制),并且它工作正常:D – qiz 2012-02-08 04:46:19

+0

你是什么意思“添加所有文件,而不是复制”?你应该*链接到三个项目编译的静态库。看看这里:http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project – tonklon 2012-02-08 05:37:30