[英]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.