关于在 iPad 上调试 UIAppFonts 问题的建议
我最近发现这篇文章似乎描述了我在添加自己的 ttf 时遇到的相同问题。我的应用程序冻结了。然而,这篇文章的一些内容让我感到困惑,我很想得到一些帮助来解读它。
该帖子在这里:http://web.archiveorange.com/archive/v/nagQXB5eX3YsQpevIXMk
我试图理解的相关段落如下:
连接调试器并暂停 该应用程序揭示了一个不 特别有用的调用堆栈:
__spin_lock 中的 0 0xffff028f
1 ??
导致该问题的具体代码 问题:
CTFontCollectionRef集合= CTFontCollectionCreateFromAvailableFonts(NULL); CFArrayRef 字体 = CTFontCollectionCreateMatchingFontDescriptors(集合); for(id fontDescRef in (NSArray) *)fonts) { CFStringRef fontName = CTFontDescriptorCopyAttribute((CTFontDescriptorRef)fontDescRef, kCTFontName属性); NSLog(@"%@", 字体名称); CFRelease(字体名称); }
CFRelease(字体);执行永远不会超出 第二行。
问题:他如何找出导致问题的线路和函数?这是否与显示反汇编、以混合模式显示或在映射文件中查找十六进制值有关?我想了解这是如何完成的。
被要求提供演示并 因此进一步调查后, 我发现问题出现了 如果代码在我的 应用程序:didFinishLaunchingWithOptions: 但如果我有同样的东西就不会 我的初始视图的 viewDidLoad 控制器。
问题:他在这里指的“代码”是什么?该问题与通过 plist 值添加自定义字体有关,因此我不确定他可能指的是什么或我如何解决我的问题。
请帮忙!
I recently found this post which seems to describe the same problem I am having with adding my own ttf. My app freezes. However, a few things about the post confuse me, and I'd love to get some help deciphering it.
The post is here: http://web.archiveorange.com/archive/v/nagQXB5eX3YsQpevIXMk
The relevant passages that I'm trying to understand are below:
Attaching the debugger and pausing
the application reveals a not
especially helpful call stack:0 0xffff028f in __spin_lock
1 ??
Specific code that is causing the
problem:CTFontCollectionRef collection =
CTFontCollectionCreateFromAvailableFonts(NULL);
CFArrayRef fonts =
CTFontCollectionCreateMatchingFontDescriptors(collection);
for(id fontDescRef in (NSArray
*)fonts) { CFStringRef fontName = CTFontDescriptorCopyAttribute((CTFontDescriptorRef)fontDescRef,
kCTFontNameAttribute); NSLog(@"%@",
fontName); CFRelease(fontName); }
CFRelease(fonts);Execution never moves beyond the
second line.
Question: How did he figure out what line and function was causing the problem? Was this something having to do with displaying the disassembly, showing it in mixed mode, or looking up a hex value in a map file? I'd like to learn how this was done.
Having been asked to supply a demo and
hence having investigated further,
I've found that the problem manifests
if the code is in my
application:didFinishLaunchingWithOptions:
but not if I have the same stuff in
the viewDidLoad of my initial view
controller.
Question: what is 'the code' he's referring to here? The problem had to do with adding custom fonts through a plist value, so I'm not sure what he could be referring to or how I can workaround my issue.
Please Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这篇文章没有任何内容,但我确实找到了苹果开发论坛上某人发布的解决方法。基本上,从 applicationDidFinishLaunching fn: 调用此函数
,并确保包含 dlcfn.h 并将 dlsym 的结果转换为以下内容:
(BOOL()(const char))
我没有更改原始内容发布以防万一这个错误只是影响了我。
Well, nothing on figuring out this post, but I did find a workaround posted by someone on the apple dev forums. Basically, calling this from the applicationDidFinishLaunching fn:
and making sure to include dlcfn.h and to cast the result of dlsym to the following:
(BOOL()(const char))
I did not alter the original post just in case this error was just something that affected me.