Issue
I was debugging my application when I got a blank screen (simulator + web inspector). After a few seconds I decided to close both.
When I restarted the application via capacitor.
npx ionic cap run ios -l
All my ‘custom’ devices/simulators are gone. So I reinstalled some of them. But when I restarted my application (in debug mode) I realized that I was not able to open the web inspector anymore.
As you can see, Safari is able to display the device name but not the web inspector.
Notice: I still have the possibility to access it by running my application on a real Ipad and Iphone
Already tried
- Remove my last changes -
- Restart my PC -
- Mac updates -
- Empty the Safari Cache & Ios Derived Data -
- Install
Safari Technology Preview
- - Open test in several emulators (Iphone 8, Ipad Mini, Iphone PRO 14 …) -
- Open test with different targets (13.0 → 16.0) -
- Remove the Ios platform and reinsert it (
ionic cap add ios
) - - Ionic Repear (+
npm ci
) - - Update Node/Npm (16.17.0 → 18.15.0) -
- Uninstall/Reinstall XCode -
Ps: I’m not comfortable with XCode if you have any ideas on this side I am highly interested
PC Info
- Safari - Version 16.2 (18614.3.7.1.5)
- XCode - 14.3
Ionic Info
Ionic:
Ionic CLI : 6.20.8
Ionic Framework : @ionic/angular 6.6.1
@angular-devkit/build-angular : 14.2.10
@angular-devkit/schematics : 14.2.10
@angular/cli : 14.2.10
@ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 4.4.0
@capacitor/android : 4.4.0
@capacitor/core : 4.4.0
@capacitor/ios : 4.4.0
Utility:
cordova-res : 0.15.4
native-run : 1.7.2
System:
NodeJS : v18.15.0
npm : 9.5.0
OS : macOS
Temporary fix
source - “feat: New webkit feature - Inspectable WebKit, inspect production apps”
by thmclellan
Thanks @alexcroox for sharing this. It seems like a breaking change from iOS 16.3, which allowed for in-app webview contents to be inspected by default while running from Xcode.
For anyone who just upgraded to iOS 16.4 and lost their Safari > Develop > iPhone options, here is a temporary workaround that you can add to the end of the
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
function in the mainAppDelegate
class in Xcode.
// When running from Xcode in debug mode, enable webView inspection 5 seconds after startup
#if DEBUG
if #available(macOS 13.3, iOS 16.4, tvOS 16.4, *) {
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
if let vc = self.window?.rootViewController as? CAPBridgeViewController {
vc.bridge?.webView?.isInspectable = true;
}
}
}
#endif
Not elegant at all with the 5 second delay but hopefully it helps someone waiting on a future update or plugin. Tested on Capacitor 4.4.0 with Xcode 14.3 RC2 with ionic serve project setup. I found Safari Technology Preview (16.4) was required to get console logging; Safari 16.3 connected but didn’t actually show logs.