问题
Is there a way (even using private methods) to use the Safari Web Inspector in apps built for production (enterprise apps for instance).
I tried to use _setDeveloperExtrasEnabled
of WKPreferences
, but still no luck in firing the inspector once the app is deployed.
Any other trick to help javascript developers debug their app, without having access to the source code?
In other words, is there a way to distribute an app that can be inspected with the Safari Web Inspector? (using private methods is fine)
回答1:
There is no way to do that with a Distribution (enterprise, ad-hoc, app-store) certificate. The only way to have the inspector enabled is by using a Developer certificate.
Therefore I created a new fastlane lane that will use the developer certificate to create the ipa, then I'm uploading it to Fabric. In this way I'm able to distribute to my JS devs a version of the app that can be debugged with the Safari Web Inspector.
gym(
scheme: "xxx",
workspace: "xxx.xcworkspace",
export_method: "development",
output_directory: "build/",
codesigning_identity: 'iPhone Developer: yay',
use_legacy_build_api: true,
xcargs: "-arch='armv7')
回答2:
When you run your application using a Developer Provisioning Profile (i.e., via Xcode), it will automatically be inspectable. If it's downloaded via the App Store, it won't be inspectable.
There is currently no way to inspect a production application. This may be possible in the future; you can track the WebKit bugs for adding this API here:
https://bugs.webkit.org/show_bug.cgi?id=168012 https://bugs.webkit.org/show_bug.cgi?id=168013
来源:https://stackoverflow.com/questions/37524723/use-safari-web-inspector-with-apps-compiled-for-production