简体   繁体   English

AppDelegate 中未调用应用程序 openURL 函数

[英]Application openURL function not called in AppDelegate

So, in my Swift app, I'm doing SoundCloud auth with this sdk .因此,在我的 Swift 应用程序中,我正在使用此 sdk进行 SoundCloud 身份验证。 I have my redirect URI set up as appname in the info.plist, and the SoundCloud redirect URI set as appname://authorized on the SC website.我在 info.plist 中将我的重定向 URI 设置为 appname,并将 SoundCloud 重定向 URI 设置为 appname://authorized 在 SC 网站上。 However, my function in the app delegate isn't getting called after logging in. Is there anything I'm missing?但是,登录后没有调用我在应用程序委托中的函数。有什么我遗漏的吗?

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    print("function called")

    return true
}

Is this the correct function I'm supposed to implement?这是我应该实现的正确功能吗?

That method has been deprecated.该方法已被弃用。

https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623073-application https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623073-application

Use application(_:open:options:) instead: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application使用 application(_:open:options:) 代替: https : //developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
    return true
}

For iOS 13 you also have to opt out of window scenes to get that application delegate's method called.对于 iOS 13,您还必须选择退出窗口场景才能调用该应用程序委托的方法。

If you don't there are the corrispettive methods of the Scene delegate如果你没有场景委托的 corrispettive 方法

 - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts

Which apparently is not entirely enough:这显然还不够:

Credit: https://stackoverflow.com/a/60022010/8517882信用: https : //stackoverflow.com/a/60022010/8517882

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未调用方法“应用程序:openURL:选项:” - Method 'application:openURL:options:' is not called application:openURL:方法未被调用 - application:openURL: method not being called Firebase.configure() 停止 AppDelegate:OpenUrl() 被调用 - Firebase.configure() stops AppDelegate:OpenUrl() from being called 在AppDelegate中未调用委托函数 - Delegate function not called in AppDelegate AppDelegate的application:openURL:options:方法中的options参数是什么? - What is the options argument in the AppDelegate's application:openURL:options: method? 如何从UI Xctest调用Appdelegate的“ OpenURL”功能 - How to call “OpenURL” function of Appdelegate from UI Xctest UberKit application:openURL:sourceApplication没有被调用 - UberKit application:openURL:sourceApplication Not getting called application:openURL:options:在深层链接后未调用 - application:openURL:options: not called after deeplink application:openURL:sourceApplication:annotation:不被调用 - application:openURL:sourceApplication:annotation: not getting called application:openURL:sourceApplication:annotation:未在应用程序委托中调用 - application:openURL:sourceApplication:annotation: not called in app delegate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM