简体   繁体   中英

URL scheme in iOS with WebView

I'm developing an iOS application in which I want to provide users with a payment gateway, which is a web page. I'm showing this web page in a WebView. The payment gateway accepts 2 URL params - success and failure URL, which are the URLs users is redirected to after completing purchase. Redirect is done via JavaScript location.href property and works properly in desktop browser and Android app.

I've set the URLs to let's say tft://redirect/success?id=123 resp. tft://redirect/failure?id=123

I want my app to handle this redirect and show Success or Failure message to user.

I followed many tutorials including Apple's docs . First of all I'm not sure why Apple docs show scheme without slashes ( myphotoapp: instead of myphotoapp:// - does it make a real difference?)

I've registered custom scheme tft and implemented the func application(..) function according to the docs.

Now when the redirect should happen, nothing really happens, the func application is not called at all.

I started development with iOS 12 and recently switched deployment target to 13.5, however, the project structure didn't change (scene delegate missing - is it an issue?).

Can you please give me any direction? Thanks in advance.

在此处输入图像描述

According to https://stackoverflow.com/a/37240425/9046249 custom scheme behaves somewhat wierd. When I switched the scheme to http or https it works like a charm.

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