Bug 293831
| Summary: | Crash when using libswiftWebKit APIs in iOS 18.5 simulator | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Elliott Williams <emw> |
| Component: | WebKit API | Assignee: | Elliott Williams <emw> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | ap, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Other | ||
| Hardware: | Other | ||
| OS: | iOS 18 | ||
Elliott Williams
Some apps fail to launch in iOS 18.5 simulator with an error that says:
```
Library not loaded: /usr/lib/swift/libswiftWebKit.dylib
```
and later, variations of:
```
tried: '... Build/Products/Debug-iphonesimulator/libswiftWebKit.dylib' (no such file)
```
This happens to apps that have a deployment target of iOS 18.3 or older, and use WebKit APIs which are annotated with NS_REFINED_FOR_SWIFT. These are:
```
WKPDFConfiguration.rect
WKWebView.callAsyncJavaScript(_:arguments:in:in:completionHandler:)
WKWebView.callAsyncJavaScript(_:arguments:in:contentWorld:)
WKWebView.createPDF(configuration:completionHandler:)
WKWebView.pdf(configuration:)
WKWebView.createWebArchiveData(completionHandler:)
WKWebView.evaluateJavaScript(_:in:in:completionHandler:)
WKWebView.evaluateJavaScript(_:in:contentWorld:)
WKWebView.find(_:configuration:completionHandler:)
WKWebView.find(_:configuration:)
WKWebsiteDataStore.proxyConfigurations
```
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Elliott Williams
rdar://152200884
Elliott Williams
At this time, there are some workarounds that developers can use for testing and debugging in iOS 18.5 simulator:
Option 1: Change your app's deployment target to iOS 18.4 or later.
1. Set `IPHONEOS_DEPLOYMENT_TARGET = 18.4` in build settings, or use Xcode's UI: Select the app's target in a xcodeproj file, then go to General > Minimum Deployments > iOS and set it to 18.4.
2. Rebuild the app.
---
Option 2: Set DYLD_FALLBACK_LIBRARY_PATH in the app's run action. This will allow you to test in iOS 18.5 simulator while continuing to deploy to older OS versions.
1. Find the simulator runtime's path using `xcrun simctl list runtimes -v`. It will be a path like "/Library/Developer/CoreSimulator/Volumes/iOS_22F77/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.5.simruntime".
2. Add "Contents/Resources/RuntimeRoot/System/Cryptexes/OS/usr/lib/swift" to this path.
3. In Xcode, navigate to the launch arguments pane of your app's scheme. (Product > Scheme > Edit Scheme > Run > Arguments). Add a "DYLD_FALLBACK_LIBRARY_PATH" environment variable, whose value is the path you computed. It will be something like this:
```
DYLD_FALLBACK_LIBRARY_PATH = /Library/Developer/CoreSimulator/Volumes/iOS_22F77/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.5.simruntime/Contents/Resources/RuntimeRoot/System/Cryptexes/OS/usr/lib/swift
```
4. Run the app (no need to rebuild).
Elliott Williams
Pull request: https://github.com/WebKit/WebKit/pull/46146
EWS
Committed 295876@main (d53b778e73ac): <https://commits.webkit.org/295876@main>
Reviewed commits have been landed. Closing PR #46146 and removing active labels.
Elliott Williams
Re-opening for pull request https://github.com/apple/WebKit/pull/3150
EWS
Committed 289651.558@safari-7621-branch (074e23185bb1): <https://commits.webkit.org/289651.558@safari-7621-branch>
Reviewed commits have been landed. Closing PR #3150 and removing active labels.