Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get exception at `CTFontManagerRegisterFontsForURL`

Tags:

objective-c

@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

EDIT:enter image description here

like image 414
Gank Avatar asked Sep 28 '22 01:09

Gank


1 Answers

There might be nothing to solve. Hitting an exception breakpoint doesn't mean your app crashes. The exception might be caught internally and the app continues just fine. So the fact that you hit an exception breakpoint might not matter. The question is what happens if you continue, or if you just disable the exception breakpoint entirely. If you don't crash when the exception breakpoint is disabled, then you should just ignore the fact that you pause there when it is enabled.

like image 70
matt Avatar answered Nov 16 '22 14:11

matt