SFSafariViewController 的问题

Problems with SFSafariViewController

作为 iOS 9 ATS 更改的一部分,我正在更新应用程序以将 SFSafariViewController 用于第三方 http 网站。

当我初始化并呈现实例时,我得到的只是一个空白的白色视图。没有导航栏,没有内容..什么都没有。这在设备 (iOS 9.1) 和模拟器 (iOS 9.1) 上都会发生。但是在设备上,大约一分钟后我收到以下调试器消息:

Failed to get remote view controller with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.uikit.viewservice.com.apple.SafariViewService was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection to service named com.apple.uikit.viewservice.com.apple.SafariViewService was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}

该应用程序正确包含 SafariServices 框架。我创建了一个测试项目,看看我的 SDK 安装是否有问题,但该项目运行良好。

我已通过 Apple Developer Portal 请求支持,并在 Apple Developer Forums 上提出了这个问题。任何人都知道这是什么或如何解决它?

Apple 开发人员技术支持已回复我以下内容:

There is a bug in the toolbar class used by the Safari View Controller that causes it to continuously perform layout (essentially in an infinite loop) if it or any of its bar buttons have a background image applied via the appearance proxy.

As a workaround, you'll either need to remove the line of code or restrict the appearance customization to instances where the UIBarButtonItem is contained within your own view controller's (you may need to subclass UINavigationController so that you can target your subclass with [UIBarButtonItem appearanceWhenContainedIn:]).

很高兴看到您用来实例化 SFVC 的代码,但是,请确保您像这样使用 initWithURL:

SFSafariViewController *sfvc = [[SFSafariViewController alloc]initWithURL:URL entersReaderIfAvailable:YES];