CTFontManagerRegisterFontsForURL无法在设备上运行

时间:2014-04-25 10:50:06

标签: ios fonts download

我正在尝试使用CTFontDescriptorMatchFontDescriptorsWithProgressHandler下载字体。与Apple提供的示例相同: https://developer.apple.com/library/ios/samplecode/DownloadFont/Listings/DownloadFont_ViewController_m.html

它工作正常,我可以在我的应用程序中显示下载的字体,但是在我重新启动应用程序后,我无法使用fontWithName:size:创建UIFont,[UIFont familyNames]不包含下载的字体。要解决此问题,我记录字体路径并使用CTFontManagerRegisterFontsForURL在启动应用程序时注册字体。完成此操作后,模拟器上的一切正常,但无法在设备上运行!!! 帮助!!!

1 个答案:

答案 0 :(得分:2)

最后,我发现问题是当字体文件网址类似于CTFontManagerRegisterFontsForURL时,/var/mobile/.../XXX.ttc会失败,并且在我将网址修改为file:///var/mobile/.../XXX.ttc后,所有内容都将是行。

相关问题