关于Xcode中调试UIWebview加载PDF 崩溃的bug

打开Xcode进行调试UIWebView进行加载本地PDF进行显示,若连接Xcode会崩溃。不连接Xcode调试,直接打开app进行展示却不会崩溃。这应该是Xcode的一个bug。

self.title = @"最终用户许可协议";

NSString *path = [[NSBundle mainBundle] pathForResource:@"License_hemu" ofType:@"pdf"];

NSURL *url = [NSURL fileURLWithPath:path];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[self.showWebView  loadRequest:request];


Disabling the "Break on all Exceptions" breakpoint solved my problem, which was coming after UIWebPDFView _removeBackgroundImageObserverIfNeeded in the stacktrace. Who would think a breakpoint would cause a crash?


I've found that you can just continue in the debugger after hitting the breakpoint. There's probably an exception that's being caught and handled in Apple's code, so even through the exception triggers the breakpoint, it doesn't lead to a crash.


I have this exact problem as well. Big thanks to Steve for helping me narrow it down even further, my exception is the same as his.

Do you have break on all exceptions set? I found that if I disable that breakpoint, it doesn't crash any more. Which got me thinking it was just some bug in the new debugger or iOS version? The other thing that got me thinking that was that this crash does not occur when I run on a device with iOS 4.3.x or the 4.3 simulator.

你可能感兴趣的:(关于Xcode中调试UIWebview加载PDF 崩溃的bug)