{"componentChunkName":"component---src-templates-blog-post-js","path":"/how-to-integrate-vuukle-in-native-mobile-application-ios/","result":{"data":{"site":{"siteMetadata":{"title":"Vuukle Docs","author":"Vuukle"}},"markdownRemark":{"id":"11f5f0eb-9707-510f-95eb-855c97a632e1","html":"<p>We want to create the best experience possible for you. You have no need to update SDK anymore, since it’s in the web view we will handle the heavy lifting for you. You will get the latest updates and new features as soon as they are uploaded on our servers.</p>\n<p>You will be working with our <strong>iframe URL’s</strong></p>\n<p>Comment widget iframe looks like this:</p>\n<p><a href=\"https://cdn.vuukle.com/amp.html?apiKey=c7368a34-dac3-4f39-9b7c-b8ac2a2da575&#x26;host=smalltester.000webhostapp.com&#x26;id=381&#x26;img=https://smalltester.000webhostapp.com/wp-content/uploads/2017/10/wallhaven-303371-825x510.jpg&#x26;title=Newpost&#x26;url=https://smalltester.000webhostapp.com/2017/12/new-post-22#1\">https://cdn.vuukle.com/amp.html?apiKey=c7368a34-dac3-4f39-9b7c-b8ac2a2da575&#x26;host=smalltester.000webhostapp.com&#x26;id=381&#x26;img=https://smalltester.000webhostapp.com/wp-content/uploads/2017/10/wallhaven-303371-825x510.jpg&#x26;title=Newpost&#x26;url=https://smalltester.000webhostapp.com/2017/12/new-post-22#1</a></p>\n<p><strong>Required parameters (for comment widget iframe):</strong></p>\n<ol>\n<li>apiKey - Your API key (<a href=\"https://docs.vuukle.com/how-to-embed-vuukle-2.0-via-js/\">https://docs.vuukle.com/how-to-embed-vuukle-2.0-via-js/</a>)</li>\n<li>host - your site host (Exclude http:// or www.)</li>\n<li>id -unique article ID</li>\n<li>img - article image</li>\n<li>title - article title</li>\n<li>url - article URL (include http:// or www.)</li>\n</ol>\n<p>Emote widget iframe looks like this:</p>\n<p><a href=\"https://cdn.vuukle.com/widgets/emotes.html?apiKey=c7368a34-dac3-4f39-9b7c-b8ac2a2da575&#x26;host=smalltester.000webhostapp.com&#x26;articleId=381&#x26;img=https://smalltester.000webhostapp.com/wp-content/uploads/2017/10/wallhaven-303371-825x510.jpg&#x26;title=New%20post%2022&#x26;url=https://smalltester.000webhostapp.com/2017/12/new-post-22#1\">https://cdn.vuukle.com/widgets/emotes.html?apiKey=c7368a34-dac3-4f39-9b7c-b8ac2a2da575&#x26;host=smalltester.000webhostapp.com&#x26;articleId=381&#x26;img=https://smalltester.000webhostapp.com/wp-content/uploads/2017/10/wallhaven-303371-825x510.jpg&#x26;title=New%20post%2022&#x26;url=https://smalltester.000webhostapp.com/2017/12/new-post-22#1</a></p>\n<p><strong>Required parameters (for emote widget iframe):</strong></p>\n<ol>\n<li>apiKey - Your API key (<a href=\"https://docs.vuukle.com/how-to-embed-vuukle-2.0-via-js/\">https://docs.vuukle.com/how-to-embed-vuukle-2.0-via-js/</a>)</li>\n<li>host - your site host (Exclude http:// or www.)</li>\n<li>articleId -unique article ID</li>\n<li>img - article image</li>\n<li>title - article title</li>\n<li>url - article URL (include http:// or www.)</li>\n</ol>\n<p>If you have any additional options to include, please contact support@vuukle.com</p>\n<p><strong>Integration Steps</strong></p>\n<p>WKWebView is still not available on Interface Builder. However, it is very easy to add them via code.</p>\n<h3>Example:</h3>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">import WebKit\n\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    // MARK: - Create WKWebView with configuration\n\n    let configuration = WKWebViewConfiguration()\n    let wkWebView = WKWebView(frame: &quot;your frame&quot;, configuration: configuration)\n\n    // MARk: - Add WKWebView to main view\n\n    self.view.addSubview(wkWebView)\n\n    let urlName = &quot;yourUrl&quot;\n\n    if let url = URL(string: urlName) {\n        wkWebView.load(URLRequest(url: url))\n    }\n\n}</code></pre></div>\n<h3>Example for log out by clearing cookies:</h3>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">private func clearAllCookies() {\n    let cookieJar = HTTPCookieStorage.shared\n\n    for cookie in cookieJar.cookies! {\n        cookieJar.deleteCookie(cookie)\n    }\n}\n\nprivate func clearCookiesFromSpecificUrl(yourUrl: String) {\n    let cookieStorage: HTTPCookieStorage = HTTPCookieStorage.shared\n    let cookies = cookieStorage.cookies(for: URL(string: yourUrl)!)\n    for cookie in cookies! {\n        cookieStorage.deleteCookie(cookie as HTTPCookie)\n    }\n}</code></pre></div>\n<h3>Handling “Report comment”:</h3>\n<p>Note : your main <strong>ViewController</strong> must extends <strong>WKUIDelegate</strong>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">// MARK: - Show confirm alert\n\nfunc webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -&gt; Void) {\n\n    let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)\n\n    alertController.addAction(UIAlertAction(title: &quot;Ok&quot;, style: .default, handler: { (action) in\n        completionHandler(true)\n    }))\n\n    alertController.addAction(UIAlertAction(title: &quot;Cancel&quot;, style: .default, handler: { (action) in\n        completionHandler(false)\n    }))\n\n    self.present(alertController, animated: true, completion: nil)\n}</code></pre></div>\n<h3>Handling authorization process:</h3>\n<p>Note : your main <strong>ViewController</strong> must extends <strong>WKUIDelegate</strong>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">private var isPopUpAppeared = false\n\n// MARK: - Show authorization tab\n\nfunc webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -&gt; WKWebView? {\n    if navigationAction.targetFrame == nil {\n        let popup = WKWebView(frame: self.view.frame, configuration: configuration)\n        popup.uiDelegate = self\n        self.view.addSubview(popup)\n        isPopUpAppeared = true\n        return popup\n    }\n    return nil\n}\n\n// MARK: - Close authorization tab\n\nfunc webViewDidClose(_ webView: WKWebView) {\n    if isPopUpAppeared {\n        webView.removeFromSuperview()\n    }\n}</code></pre></div>\n<p>The full application example you can <a href=\"https://github.com/lesukk/vuukle_iOS_SDK/tree/web_sdk_iOS\">check here</a></p>","frontmatter":{"title":"How to integrate Vuukle web version into your native iOS application","date":"May 01, 2017","category":"Install Vuukle","tags":["how to","install","vuukle","native","ios"],"shortDescription":"We want to create the best experience possible for you. You have no need to update SDK anymore, since it's in the web view we will handle the heavy lifting for you. You will get the latest updates and new features as soon as they are uploaded on our servers"}}},"pageContext":{"id":"11f5f0eb-9707-510f-95eb-855c97a632e1"}}}