turbolinks / turbolinks-ios

Native iOS adapter for building hybrid apps with Turbolinks 5
MIT License
881 stars 92 forks source link

session:openExternalURL not firing on first load? #72

Closed berardpb closed 8 years ago

berardpb commented 8 years ago

First of all, great job with Turbolinks and the ios adapter. I'm a big fan, and very appreciative.

I might be doing something wrong, but I'm having a problem using the 'session:openExternalURL:' method. I'm trying to handle a mailto link, and, for illustration purposes, just doing something basic:

func session(session: Session, openExternalURL URL: NSURL) {
        print("opening an external url: " + URL.absoluteString)
        let url = URL.absoluteString
        let url_elements = url.componentsSeparatedByString(":")
        if(url_elements[0] == "mailto"){
            print("we need to mail! to this address: " + url_elements[1])
        }
    }

For some reason, this is not firing when the page first loads. It only fires when I pull-to-refresh. Anyone have an idea as to what might be going on here?

Note, I found and originally posted in this thread: https://github.com/turbolinks/turbolinks-ios/pull/34#issuecomment-250908389

Thanks, all!

berardpb commented 8 years ago

Ok, my problem was related to setting my own navigation delegate, which, as the documentation describes, causes Turbolinks to "no longer invoke the Session delegate’s session:openExternalURL: method." Closing. Thanks again.