NaverLoginUrlHandler
The one thing NAVER Login needs from your iOS app.
A login leaves the app — to the NAVER app when it is installed, to a browser when it is not — and comes back through the custom URL scheme in your NaverLoginConfig. Something has to hand that URL to the SDK, or the login never completes: the browser closes, your app comes forward, and NaverLogin.login() suspends for as long as the coroutine lives.
From SwiftUI:
ContentView()
.onOpenURL { url in
_ = NaverLoginUrlHandler.shared.handle(url: url)
}From UIKit, forward whichever of these your app actually receives:
// AppDelegate, in an app with no scene delegate
func application(_ app: UIApplication, open url: URL, options: …) -> Bool {
NaverLoginUrlHandler.shared.handle(url: url)
}
// SceneDelegate, in a scene-based app — where the AppDelegate method above never fires
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }
_ = NaverLoginUrlHandler.shared.handle(url: url)
}The split matters more than it looks. A SwiftUI App is scene-based, so UIKit delivers incoming URLs to the scene and application(_:open:options:) is never called — a SwiftUI app that implements only that one has a login which opens the browser and then hangs, with nothing in the console to say why. .onOpenURL is the only thing that works there.