Skip to content
This repository has been archived by the owner on May 21, 2023. It is now read-only.

Commit

Permalink
fix: Resolve WebKitErrorDomain 102 (#3)
Browse files Browse the repository at this point in the history
Ignore WebKitErrorDomain 102 error.
  • Loading branch information
ivan-magda committed Feb 13, 2018
1 parent cfffee2 commit 81c8d74
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Tagger/FlickrOAuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,23 @@ class FlickrOAuthViewController: UIViewController {
extension FlickrOAuthViewController: UIWebViewDelegate {

func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
let callback = NSURL(string: callbackURL)!
if request.URL!.host == callback.host {
guard let url = request.URL else {
return false
}

if url.host == callbackURL.host {
successBlock(URL: request.URL!)
dismiss()
return false
}

if url.scheme != "http" && url.scheme != "https" {
if UIApplication.sharedApplication().canOpenURL(url) {
UIApplication.sharedApplication().openURL(url)
return false
}
}

return true
}

Expand All @@ -132,6 +143,16 @@ extension FlickrOAuthViewController: UIWebViewDelegate {
}

func webView(webView: UIWebView, didFailLoadWithError error: NSError?) {
// Ignore NSURLErrorDomain error -999.
if (error?.code == NSURLErrorCancelled) {
return
}

// Ignore "Fame Load Interrupted" errors. Seen after app store links.
if (error?.code == 102 && error?.domain == "WebKitErrorDomain") {
return
}

guard let error = error else {
let error = NSError(domain: "\(BaseErrorDomain).FlickrOAuthViewController",
code: 66,
Expand Down

0 comments on commit 81c8d74

Please sign in to comment.