2

So, in my Swift app, I'm doing SoundCloud auth with this sdk. 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. 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?

John Fda
  • 317
  • 1
  • 4
  • 7
  • where is the documentation on setting up redirect url ? the github page doesnt have it. – Shubhank Apr 25 '16 at 18:16
  • Yes this is correct function. If your app is running and in background openURL should be called but if app is in not active or terminated state then you have to check in disFinishLaunching – Arun Gupta Apr 25 '16 at 18:29

2 Answers2

0

That method has been deprecated.

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

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

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
    return true
}
atreat
  • 4,243
  • 1
  • 30
  • 34
0

For iOS 13 you also have to opt out of window scenes to get that application delegate's method called.

If you don't there are the corrispettive methods of the Scene delegate

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

Which apparently is not entirely enough:

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

Enricoza
  • 1,101
  • 6
  • 18