相关疑难解决方法(0)

CGFontCreateWithDataProvider在飞行模式下挂起

当我CGFontCreateWithDataProvider 在飞机模式下拨打电话时,我的应用会冻结.不是飞机模式,它工作正常.字体存储在设备上,不应该发生网络访问.

在调用此方法加载本地字体文件时:

[self registerIconFontWithURL:[[NSBundle mainBundle] URLForResource:@"FontAwesome" withExtension:@"otf"]];
Run Code Online (Sandbox Code Playgroud)

的值url在下面的方法是: 文件:///var/mobile/Applications/48D3DA14-235B-4450-A081-7A6BA6116667/Blah.app/FontAwesome.otf

+ (void)registerIconFontWithURL:(NSURL *)url
{
    NSAssert([[NSFileManager defaultManager] fileExistsAtPath:[url path]], @"Font file doesn't exist");
    CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL((__bridge CFURLRef)url);

//******Freezes after the next line******
    CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
//******FROZEN******

    CGDataProviderRelease(fontDataProvider);
    CFErrorRef error;
    CTFontManagerRegisterGraphicsFont(newFont, &error);
    CGFontRelease(newFont);
}
Run Code Online (Sandbox Code Playgroud)

iOS 7.1.x,iPhone 5.

我不知道为什么会发生这种情况并且无法找到任何帮助.有没有人知道为什么会发生这种情况?

提前致谢!

fonts objective-c freeze ios

11
推荐指数
1
解决办法
1690
查看次数

标签 统计

fonts ×1

freeze ×1

ios ×1

objective-c ×1