As part of the iOS 9 ATS changes I'm updating an app to use SFSafariViewController for third-party http websites.
When I init and present the instance all I get is a blank white view. No navigation bar, no content..nothing at all. This happens on both device (iOS 9.1) and simulator (iOS 9.1). However on device I get the following debugger message after a minute or so:
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.}
The app correctly includes the SafariServices framework. I created a test project to see whether it's possible my SDK installation was at fault but that project works perfectly.
I've requested support via the Apple Developer Portal and raised this on the Apple Developer Forums. Anyone got any idea what this is or how to resolve it?
Apple Developer Technical Support has come back to me with the following:
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:]).