【问题标题】:PSPDFKit and UIWebView doesn't work togetherPSPDFKit 和 UIWebView 不能一起工作
【发布时间】:2014-07-28 06:29:31
【问题描述】:

我将 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: decidePolicyForNavigationAction?但是分辨率不是很清楚!

谢谢

【问题讨论】:

    标签: ios uiwebview pspdfkit


    【解决方案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-01-07
      • 2019-08-17
      • 2016-11-23
      • 2019-02-18
      • 2015-05-16
      • 2017-10-14
      • 2012-06-01
      • 2011-11-05
      • 2018-05-20
      相关资源
      最近更新 更多