ios - 未调用方法 'application:openURL:options:'

标签 ios swift ios13 custom-scheme-url

我正在尝试使用自定义方案从网页打开我的应用程序。应用程序已打开,但未调用以下方法:

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

我的 info.plist如下所示:
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>MyApp</string>
            </array>
            <key>CFBundleURLName</key>
            <string>url here</string>
        </dict>
    </array>

该项目是使用 Xcode 11.1 创建的,我正在 iOS 13 上进行测试。

最佳答案

实现scene(_:openURLContexts:)在您的场景委托(delegate)中。

如果 URL 启动您的应用程序,您将获得 scene(_:willConnectTo:options:)相反,它在 options .

关于ios - 未调用方法 'application:openURL:options:',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58624786/

相关文章:

iOS 13.2 消息 : nehelper sent invalid result code [1] for Wi-Fi information request

ios - Realm 是否支持 iOS 中的 LIMIT 查询?

swift - ios13 使用 PHImageManager 获取原始图像

ios - iOS 13 上未调用supportedInterfaceOrientations

uistoryboard - 如何在 UITabBarController 中使用@IBSegueAction?

ios - 取消完成处理程序 (iOS)

ios - Swift:为什么切换文本字段有效?

swift - MKPolyLine swift 4

swift - 动态 scrollView contentSize autoLayoutConstraints swift

iphone - dispatch_async 进入无限循环