2013-05-09 63 views
15

它不能编译源代码,并写道:iOS。更新此项目中的cocos2d库后无法运行项目

Undefined symbols for architecture i386:
"_CTFontManagerRegisterFontsForURL", referenced from: -[CCLabelTTF getFontName:] in CCLabelTTF.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

但是当我更换所有的代码在以下功能CCLabelTTF与“回归零”:

- (NSString*) getFontName:(NSString*)fontName 
{ 
    // Custom .ttf file ? 
    if ([[fontName lowercaseString] hasSuffix:@".ttf"]) 
    { 
     // This is a file, register font with font manager 
     NSString* fontFile = [[CCFileUtils sharedFileUtils] fullPathForFilename:fontName]; 
     NSURL* fontURL = [NSURL fileURLWithPath:fontFile]; 
     CTFontManagerRegisterFontsForURL((CFURLRef)fontURL, kCTFontManagerScopeProcess, NULL); 

     return [[fontFile lastPathComponent] stringByDeletingPathExtension]; 
    } 

    return fontName; 
} 

然后我可以编译我的代码,但我不能使用标签。

那么如何在不创建新项目的情况下解决此问题并将所有源复制到它?

EDITED

以前的版本2.X,现在我有最后的RC2版本。

我删除了旧库的所有文件,将文件从新库复制到项目文件夹中,并通过xcode将它们添加到项目中。 xcode可以用新的库文件创建项目,所以我从这个新项目中拿走了它们。然后我做了一些更改以删除警告。

+0

你是怎么进行升级?从哪个版本到哪个vrsion? – LearnCocos2D 2013-05-09 17:49:17

+0

我编辑了我的问题来回答你的问题 – Gargo 2013-05-09 18:25:44

回答

42

解决通过导入CoreText.framework

但我想我会创建一个新的项目,因为我仍然有一些麻烦与识别的iPhone5屏幕尺寸