0

我将 PSPDFKit 用于链接到一个主项目的静态框架,该主项目使用另一个带有 UIWebView 的静态框架。

加载主项目后,当我启动 UIWebView 并调用请求时,出现此错误:

void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

并且webview中没有附加任何内容。

如果我没有将 PSPDFKit 加载到我的第一个框架中,则问题不会出现,一切正常。

我还发现,如果我链接 PSPDFKit 而不是 PSPDFKit 所需的所有框架,我有同样的错误。我必须删除 MessageUI 框架才能获得正确的行为。但是当我在没有 MessageUI 的情况下包含 PSPDFKit 时,就会出现错误。

有人有解决它的想法或找到解决方法吗?

该错误发生在 iOS 7 版本上,仅出现在不在模拟器上的设备上。在 iOS 6 中一切正常。

我发现这篇文章UIWebView:decisionPolicyForNavigationAction?但分辨率不是很清楚!

谢谢

4

1 回答 1

1

所以我解决了这个错误。我不知道为什么会出现这个错误,也不知道为什么我的修复工作。

事实上,为了与 iOS 5 兼容,我删除了旧代码。这段代码使用了objc/runtime.h库,如果它们没有实现,它的目标是注入我们所有的 UIViewController 子类shouldAutorotateToInterfaceOrientation:

我们使用这段代码来做到这一点

Method shouldAutorotateToInterfaceOrientation = class_getInstanceMethod([self class], @selector(shouldAutorotateToInterfaceOrientation:));
class_addMethod(class, @selector(shouldAutorotateToInterfaceOrientation:), method_getImplementation(shouldAutorotateToInterfaceOrientation), method_getTypeEncoding(shouldAutorotateToInterfaceOrientation));
于 2014-08-08T05:54:40.827 回答