Reproducibility
100% on iOS 15.4 and iOS 16.6
Zero crash on iOS 18.6
Xcode 26.1
Steps to Reproduce
- Xcode 26.1 → New iOS App
- Replace ViewController.swift with the 20-line code below
- Run on real device
• iPhone XR iOS 15.4
• iPhone 13 iOS 16.6 - Tap the link → breakpoint in decidePolicyFor
- lldb → po navigationAction.sourceFrame
Actual Result (lldb) po navigationAction.sourceFrame nil
Swift declaration lies: public var sourceFrame: WKFrameInfo { get } // non-optional
→ Instant EXC_BREAKPOINT
libswiftFoundation.dylib`URLRequest._unconditionallyBridgeFromObjectiveC
Objective-C tells the truth: po [(WKNavigationAction *)navigationAction fixedSourceFrame] nil
iOS 18.6 → same code prints a valid WKFrameInfo, no crash.
Expected
sourceFrame must be declared WKFrameInfo? in Swift
or at least documented “can be nil on iOS 15–16”.
Impact Every WKWebView app that touches sourceFrame on iOS 15.4 & 16.6 ships with a latent crash.
Production Workaround @implementation WKNavigationAction (Safe)
- (WKFrameInfo *)fixedSourceFrame { return self.sourceFrame ? self.sourceFrame : nil;
} @end
Minimal Test (copy-paste) import UIKit import WebKit
class ViewController: UIViewController, WKNavigationDelegate { lazy var web = WKWebView(frame: view.bounds)
override func viewDidLoad() {
super.viewDidLoad()
web.navigationDelegate = self
view.addSubview(web)
web.load(URLRequest(url: URL(string: "https://www.apple.com")!))
}
func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
preferences: WKWebpagePreferences,
decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences)->Void) {
print(navigationAction.sourceFrame) // ← crashes on 15.4 & 16.6
decisionHandler(.allow, preferences)
}
}
Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.
Bug Reporting: How and Why? has tips on creating your bug report.