gpt4 book ai didi

iOS 获取重定向的 URL

转载 作者:行者123 更新时间:2023-11-29 00:14:32 25 4
gpt4 key购买 nike

在我的 iOS 项目中,我需要调用一个 url https://myemail.mycompany.com/?qs=23263726373273ADSD892329389DFDJFHD232323并将其重定向到另一个 URL http://redr.mycompany.com/first/location/id/next/a/ .我需要在我的 iOS 代码中获取重定向的 URL,我将编写我的逻辑来解析它。我该怎么做,有人可以帮助我吗。

最佳答案

From what I inferred is that you want to capture the link that redirects to the app when clicked.

If that's right, then you need to implement a method in your app delegate class

   @available(iOS 9.0, *)
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {

return true
}

@available(iOS 8.0, *)
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {

if url.scheme == "SOMETHING YOU WANT TO MATCH" {

return false

}

if url.host == "SOMETHING YOU WANT TO MATCH" {

return false

}

return true
}

引用此link有关更多详细信息,它还描述了所有场景和实现。

关于iOS 获取重定向的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45598309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com