Get exception in `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 an exception breakpoint and every time she gets an exception in CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeNone, &error); How to solve it?enter image description here

EDIT: enter image description here

+4
source share
1 answer

. , . , . , , , . , , , . , , , , .

+4

All Articles