kakao / kakao_flutter_sdk

Flutter SDK for Kakao Open API
Apache License 2.0
192 stars 71 forks source link

[Bug] iOS에서 override func application(_ app: UIApplication, open ...) 사용시, loginWithKakaoTalk() 함수가 동작하지 않습니다. #180

Closed ttb-inc closed 1 year ago

ttb-inc commented 1 year ago

이슈 설명 (Issue description)

안녕하세요.

iOS에서 AppDelegate.swift에 아래 코드를 사용할경우, loginWithKakaoTalk() 함수가 동작하지 않습니다.

    override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

        ApplicationDelegate.shared.application(
                                app,
                                open: url,
                                sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                annotation: options[UIApplication.OpenURLOptionsKey.annotation]
                            )

    }

위 코드를 제거하면, loginWithKakaoTalk() 가 정상동작 합니다. (참고로 위 코드는 Facebook 로그인을 사용하기위해서 추가해서 사용하고 있습니다.)


AppDelegate.swift

import UIKit
import Flutter
import FBSDKCoreKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {

      if #available(iOS 10.0, *) {
        UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
      }

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

    override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

        ApplicationDelegate.shared.application(
                                app,
                                open: url,
                                sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                annotation: options[UIApplication.OpenURLOptionsKey.annotation]
                            )

    }

}

앱 ID (App ID)

876154

플랫폼 (Platform)

iOS 16+

디바이스 (Device)

iPhone SE3

Version

kakao_flutter_sdk: 1.4.3

Flutter SDK

Flutter 3.10.3

재현 방법 (Steps to reproduce)

...

코드 샘플 (Code Sample)

AppDelegate.swift

import UIKit
import Flutter
import FBSDKCoreKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {

      if #available(iOS 10.0, *) {
        UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
      }

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

    override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

        ApplicationDelegate.shared.application(
                                app,
                                open: url,
                                sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                annotation: options[UIApplication.OpenURLOptionsKey.annotation]
                            )

    }

}

Logs

로그가 없습니다.

Flutter Doctor

[✓] Flutter (Channel stable, 3.10.3, on macOS 13.4 22F66 darwin-arm64, locale ko-KR)
    • Flutter version 3.10.3 on channel stable at /Users/jeonglockpark/Desktop/work/flutter_sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f92f44110e (3 days ago), 2023-06-01 18:17:33 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/jeonglockpark/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Network resources
    • All expected network resources are available.

• No issues found!
mbkim95 commented 1 year ago

안녕하세요

첨부해주신 코드의 application(_:open:options:)에 별도의 반환 값이 없어서 kakao_fluttersdk에 구현된 `application(:open:options:)이 실행되지 않는 것으로 보입니다.return super.application(app, open: url, options: options)` 추가해주시면 정상 동작할 것 같아요

ttb-inc commented 1 year ago

확인해보겠습니다. 감사합니다.

ttb-inc commented 1 year ago

정상동작 확인 했습니다. 제가 잘못 사용하고 있었네요... 도움 주셔서 감사합니다. ^^