简体   繁体   中英

iOS: Open a registered open URL from within the same app

I am running into a situation which I am not sure is possible from technical/design point of view. Please advise.

Here is what I need:

  1. I have an open URL registered for my native iOS app. I expect a request ID to be passed along with it and once hit I open that request.
  2. From within my native iOS app, I need to open a web page in the webview. This page has few buttons in it.
  3. A tap on the button in the webview should open the request inside my app. So, I want to trigger the registered open URL in step #1.

Web page data is dynamic and will change on the fly.

Is this a feasible design. Shall I consider something else.

Any advise/pointers will be appreciated.

This should be possible. Here's a though:

1: Implement the UIWebview delegate method shouldStartLoadWithRequest. 2: when you intercept that your webview is attempting to access the url yourapp://blah-blah-blah you can return NO instead dip into your appdelegate can manually call the function handleOpenURL.

I've seen something similar in the past with supporting oAuth (I believe it was with instagram) within one of our apps. We basically loaded up the login page in a UIWebview and then when we detected the the post login redirect we parsed the oAuth token from the url and called it good.

Good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM