2

I have a weird issue, when a user is selecting text in a WkWebView and clicks copy my app freezes up. There is no code run for copying it's just a user using the wkWebView normally.

No crash or error is shown but the log shows:

Returning local object of class NSString PBItemCollectionServicer connection disconnected.

When i pause the debugger this is all I see:

threads

How do i go about debugging this? Any ideas?

andromedainiative
  • 4,414
  • 6
  • 22
  • 34

1 Answers1

0

I was unsuccessful in debugging the cause of this issue but our interim solution was to provide our users with a long press action to copy the meta data that is relevant to the user in that view.

Based of this answer: UIWebView without Copy/Paste when displaying PDF files

let longPress =UILongPressGestureRecognizer(target: self, action: #selector(copyOptions))
longPress.allowableMovement = 100
longPress.minimumPressDuration = 0.3
longPress.delegate = self
longPress.delaysTouchesBegan = true
longPress.delaysTouchesEnded = true
longPress.cancelsTouchesInView = true
self.wrapper.addGestureRecognizer(longPress)

func copyOptions () {
    let alertController = UIAlertController(title: "Copy", message: nil, preferredStyle: .alert)

    alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { action in

    }))

    if let someValue = self.someObject?.someValue {
        alertController.addAction(UIAlertAction(title: "Copy Some Value", style: .default, handler: { action in
            UIPasteboard.general.string = someValue
        }))
    }


    self.present(alertController, animated: true, completion: nil)
}
andromedainiative
  • 4,414
  • 6
  • 22
  • 34