2014-05-24 5 views
0

내 프로젝트를 Cocos2D v2.1에서 V3.0으로 변환하고 있습니다. 이것은 Cocos2D가 하위 프로젝트로 추가 된 UIKit 프로젝트이며, 감독은 몇 개의 뷰 컨트롤러에 느리게로드되었습니다. Cocos2D V3.0 crash CCLabelTTF

-[NSConcreteMutableAttributedString hasAttribute:]: unrecognized selector sent to instance 0xc4f8ff0 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableAttributedString hasAttribute:]: unrecognized selector sent to instance 0xc4f8ff0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0291a1e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x026998e5 objc_exception_throw + 44 
    2 CoreFoundation      0x029b7243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
    3 CoreFoundation      0x0290a50b ___forwarding___ + 1019 
    4 CoreFoundation      0x0290a0ee _CF_forwarding_prep_0 + 14 
    5      0x0019d7d0 -[CCLabelTTF updateTexture] + 544 
    6      0x0019d546 -[CCLabelTTF visit] + 70 
    7      0x00181c86 -[CCNode visit] + 566 
    8      0x00181c86 -[CCNode visit] + 566 
    9      0x00202b9d -[CCDirectorIOS drawScene] + 381 
    10      0x00203fdc -[CCDirectorDisplayLink mainLoop:] + 92 

CCLabelTTF 기능 - (BOOL) updateTexture의 중단 정지

에서 :

나는 그것을 잘 실행 및 감독에 벌금을로드하는 것 같지만 다음과 같이 충돌, 모든 컴파일러 경고를 제거하는 관리
#ifdef __CC_PLATFORM_IOS 

    // Font color 
    if (![formattedAttributedString hasAttribute:NSForegroundColorAttributeName]) 

코드에 하나의 CCLabelTTF이있다, 나는 그렇게처럼 만들 :

self.scoreLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"Score", @"") fontName:@"Marker Felt" fontSize:20 dimensions:CGSizeMake(100, 50)]; 
self.scoreLabel.horizontalAlignment = (CCTextAlignment)NSTextAlignmentRight; 
scoreLabel.position = ccp(250,70); 
[self addChild:scoreLabel z:1]; 

많은 도움을 주셨습니다. Cocos2D 포럼을 검색했으며 여기에서이 문제와 비슷한 것을 찾을 수 없습니다.

답변

0

아 ... 그냥 해결했습니다. Cocos2d는 서브 프로젝트이므로 대상에 Other Linker Flags 아래에 -ObjC 플래그를 포함시켜야했습니다. 이것은 v2.1에서는 필요하지 않지만 그 버전에서는 NSAttributedString+CCAdditions 카테고리를 사용하지 않았습니다.