mardi 5 mai 2015

Get exception at `CTFontManagerRegisterFontsForURL`

@implementation UIFont (FlatUI)

+ (void) initialize {
    [super initialize];
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSArray *fontNames = @[@"Lato-Regular", @"Lato-Bold", @"Lato-Italic", @"Lato-Light"];
        for (NSString *fontName in fontNames) {
            NSURL * url = [[NSBundle mainBundle] URLForResource:fontName withExtension:@"ttf"];
            if (url) {
                CFErrorRef error;
                CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeNone, &error);
            }
        }
    });
}

I add exception breakpoint, and every time it gets exception at CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeNone, &error); How to solve it?enter image description here

Aucun commentaire:

Enregistrer un commentaire