小编Arv*_*aei的帖子

深层链接 URL Scheme 不调用任何函数(swift)

即时实现深层链接是iOS。我已经在 Project-Setting->Info->Url type URL Schemes 中配置了 URL Schemes : carwash role:Viewer

当我输入 carwash://something 时,浏览器要求打开应用程序,但在应用程序中没有调用我处理应该发生的操作。

苹果文档说你应该在 AppDelegate 中覆盖 application(open url) 但深层链接不调用它并且应用程序在最后状态打开

application:openURL:options:' 未被调用

这是我的代码并且不起作用

 func application(_ app: UIApplication, open url: URL,
                     options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        fatalError()
    }

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        if let url = launchOptions?[UIApplication.LaunchOptionsKey.url] as? URL {
           /// some
            fatalError()
        }
    GMSServices.provideAPIKey("")

    return true
} 
Run Code Online (Sandbox Code Playgroud)

swift 5 模拟器:iOS 13

url-scheme deep-linking ios swift

9
推荐指数
1
解决办法
4622
查看次数

标签 统计

deep-linking ×1

ios ×1

swift ×1

url-scheme ×1