1

I am using two different Webview, using FacebookWebview1 to login 'A' user and using FacebookWebview2 to login 'B' user.

Issue Resolved: Both Webview are different but when I logged in with user 'A' in WKFBView then the same user is automatically logged in WKFBView1.(This issue is resolved using cookies)

New Issue: I am facing new issues when I move from WKFBView1 to WKFBView, WKFBView1 cookies are used in WKFBView and user logged in WKFBView1 is automatically logged in WKFBView.

So basically last saved cookies are used, but I want to save different cookies for different WKFBView.

What I want to achieve: Multiple Webview with different user logged in.

Single user means my url link ("https://www.facebook.com/").

@IBOutlet var WKFBView: WKWebView!
@IBOutlet var WKFBView1: WKWebView! 

 @IBAction func WebViewUserBtn1(_ sender: Any)
 {
   let myBlog = "https://www.facebook.com/login/"
   let processPool = WKProcessPool()
   let configuration1 = WKWebViewConfiguration()
   configuration1.processPool = processPool
   configuration1.websiteDataStore = WKWebsiteDataStore.nonPersistent()
   self.WKFBView= WKWebView(frame: self.view.frame, configuration: configuration1)
    let url = NSURL(string: myBlog)
    let request = URLRequest(url: url! as URL)
    WKFBView.navigationDelegate = self
    WKFBView.customUserAgent = "Safari/603.3.8"
    WKFBView.load(request)
    self.fbview.addSubview(WKFBView)
            }

        @IBAction func WebViewUserBtn2(_ sender: Any)
        {
          let myBlog = "https://www.facebook.com/login/"
          let processPool = WKProcessPool()
          let configuration1 = WKWebViewConfiguration()
          configuration1.processPool = processPool
          configuration1.websiteDataStore = WKWebsiteDataStore.nonPersistent()
          self.WKFBView1 = WKWebView(frame: self.view.frame, configuration: configuration1)
          let url = NSURL(string: myBlog)
          let request = URLRequest(url: url! as URL)
          WKFBView1.navigationDelegate = self
          WKFBView1.customUserAgent = "Safari/603.3.8"
          WKFBView1.load(request)
          self.fbview.addSubview(WKFBView1)
        }
Pankaj Mundra
  • 1,401
  • 9
  • 25
  • Take a look at https://stackoverflow.com/questions/38711649/separate-cookie-storage-for-two-uiwebview-or-wkwebview – TMob Dec 01 '17 at 10:16
  • What for? You are only allowed to have one personal profile anyway. – CBroe Dec 01 '17 at 11:25

0 Answers0