Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS. Cannot run a project after updating cocos2d library inside this project

It cannot compile sources and writes:

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)

but when I replace all the code in the following function in CCLabelTTF with "return nil":

- (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;
}

then I can compile my code but I cannot use labels.

So how to solve this without creating of a new project and copying all the sources to it?

EDITED

Previous version is 2.x, now I have the last rc2 version.

I have deleted all the files of the old library, copied the files from the new library into the project folder and added them to project via xcode. xcode can create projects with a new library files, so I took them from this new project. Then I made some changes to remove warnings.

like image 247
Gargo Avatar asked May 09 '13 17:05

Gargo


1 Answers

Solved by importing CoreText.framework

But I think I will create a new project because I still have some troubles with identifying of iphone5 screen size

like image 185
Gargo Avatar answered Oct 07 '22 01:10

Gargo