1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SPAなページのWKWebViewでピンチイン・ピンチアウトなどのズーム処理が効かない件の対応

Last updated at Posted at 2024-01-11

背景

WKWebviewでSPAなページだとピンチイン・ピンチアウトによる拡大・縮小処理が動作しないことがあった。
デフォルト設定では拡大縮小が有効なはずで、ためしにhttps://www.google.co.jp/を読み込ませると問題なく拡大・縮小できていた。

対応

ignoresViewportScaleLimitsを設定する。

let config = WKWebViewConfiguration()
config.ignoresViewportScaleLimits = true

webView = WKWebView(frame: .zero, configuration: config)

お悩み

  • SPAのように画面要素が動的に入れ替わるものはユーザーによるズーム制御を抑制している場合があるのか?
  • SPAで拡大縮小を繰り返しているとWebプロセス側がクラッシュすることがある。※対象ページは動画や画像が多め
0x11f001fa0 - [PID=26962] WebProcessProxy::didClose: (web process 0 crash)
0x11f001fa0 - [PID=26962] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
0x10e01c420 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid
0x10e01c420 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null)
0x1060c8018 - [pageProxyID=14, webPageID=15, PID=26962] WebPageProxy::processDidTerminate: (pid 26962), reason=Crash
0x1060c8018 - [pageProxyID=14, webPageID=15, PID=26962] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
Could not signal service com.apple.WebKit.GPU: 1: Operation not permitted
0x11f000e40 - GPUProcessProxy::gpuProcessExited: reason=IdleExit
0x11f002650 - [PID=0] WebProcessProxy::gpuProcessExited: reason=IdleExit
0x11f001470 - [PID=32027] WebProcessProxy::didClose: (web process 32027 crash)
0x11f001470 - [PID=32027] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
0x10e01c2a0 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid
0x10e01c2a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null)
0x1058ae018 - [pageProxyID=14, webPageID=15, PID=32027] WebPageProxy::processDidTerminate: (pid 32027), reason=Crash
0x1058ae018 - [pageProxyID=14, webPageID=15, PID=32027] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
0x1058ae018 - [pageProxyID=14, webPageID=15, PID=32027] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?