RxWebKit icon indicating copy to clipboard operation
RxWebKit copied to clipboard

If you use the properties implemented in RxWebKit together with the properties implemented in RxCocoa, it will crash.

Open keisukeYamagishi opened this issue 4 years ago • 0 comments

Please check to the following log for the runtime.

2021-10-28 19:14:34.228664+0900 RxWebKitSample[2594:65726] RxCocoa/RxCocoa.swift:153: Fatal error: Failure converting from Optional(<RxCocoa.RxWKNavigationDelegateProxy: 0x600003ec4900>) to RxWKNavigationDelegateProxy
(lldb) 

The sample code is attached below.

import UIKit
import RxSwift
import RxCocoa
import RxWebKit
import WebKit

class ViewController: UIViewController {

    @IBOutlet weak var webView: WKWebView!
    let disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        
        webView.load(URLRequest(url: URL(string: "https://google.com")!))
        
        webView.rx
            .didStartLoad // <- This property is implementing at the RxCocoa
            .subscribe { value in
                print("value: \(value)")
            }.disposed(by: disposeBag)
        
        webView.rx
            .didStartProvisionalNavigation // <- This property is implementing at the RxWebKit
            .asObservable()
            .subscribe { (webView: WKWebView, navigation: WKNavigation) in
                print("web: \(webView)")
                print("navigation: \(navigation)")
            }.disposed(by: disposeBag)
        // Do any additional setup after loading the view.
    }
}

The image of the runtime is attached below.

Screen Shot 2021-10-28 at 19 22 41

Error log bellow

Thread 1: Fatal error: Failure converting from Optional(<RxCocoa.RxWKNavigationDelegateProxy: 0x600003ec4900>) to RxWKNavigationDelegateProxy

keisukeYamagishi avatar Oct 28 '21 10:10 keisukeYamagishi