简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM