problem with :// chars in universal link

how can i run my app without using :// chars in url? i have payment page which is designed with angular i redirect my user to that page when we need to return the user to app but url wont exept the spcial chars in url


whats your solution?


there is button named backToApp in angular side should run my app

Replies

Most often, you can send url without h ttp:// or h ttps://


Just test it in your app.

when user goes to payment page send a packageName with url


for example :

var packageName="openApp://"
let url="http:/google.net/#/paymentPage/\(Id)/\(price!)/\(packageName)/"
print(url)
UIApplication.shared.openURL(NSURL(string: url)! as URL)



this wont sent proprly because conatins spcial chars in it

extension String {
var percentEncoded: String { return self.addingPercentEncoding(withAllowedCharacters:CharacterSet.alphanumerics)! }
}
let url = "hxxp://ipinbar.net/#/getPayedPage/\(userId.percentEncoded)/\(price!.percentEncoded)/\(packageName.percentEncoded)/"

thanks to replaying.


would you remove the domain name from your post its kinda ....


still not working. url removes the encoded string

for example:

Building URLs via string interpolation is tricky because of encoding issues. I strongly recommend that you check out

URLComponents
, which handles all of the standard cases out of the box.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"