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

1

15

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.

Dalury answered 9/5, 2013 at 17:22 Comment(2)
how did you perform the upgrade? from what version to which vrsion?Brett
I have edited my question to answer your oneDalury
D
42

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

Dalury answered 9/5, 2013 at 19:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.