문의 시 사용하시는 SDK 버전 정보를 알려주세요.
KakaoSDK (2.5.3)
SwiftUI로 카카오 로그인을 구현중인데,
사파리로 카카오 로그인을 했을 때는 문제가 없으나
카카오톡으로 로그인을 시도하면 Software caused connection abort 에러가 발생합니다.
2021-06-28 02:15:06187 [][AuthController.swift 323:21] -> code_verifier: Yc7ZizeoP6eSoL7lAvtohbfZC8TAQ2Y9t8/fHOh8CfPb1v4tE/Wfxf8DoJ21QGyUpaoi3drrYXJFJPBHMAUK1A
2021-06-28 02:15:06188 [][AuthController.swift 326:25] -> code_challenge: 6cA_orzWyHQbUReudGbWZJj4DZcOangBVMtHv4FunuI
2021-06-28 02:15:06246 [][AuthController.swift 99:25] -> 카카오톡 실행: kakaokompassauth://authorize?params=%7B%22code_challenge%22:%226cA_orzWyHQbUReudGbWZJj4DZcOangBVMtHv4FunuI%22,%22code_challenge_method%22:%22S256%22%7D&headers=%7B%22KA%22:%22sdk%5C/2.5.3%20sdk_type%5C/swift%20os%5C/ios-14.6%20lang%5C/ko-KR%20res%5C/414x896%20device%5C/iPhone%20origin%5C/com.hitupios%20app_ver%5C/1.0%22%7D&client_id=806340fec199524437001f51eedfaeb3&redirect_uri=kakao806340fec199524437001f51eedfaeb3://oauth&response_type=code
2021-06-28 14:15:08.357676+0900 hitup_ios[13098:3221788] [connection] nw_read_request_report [C1] Receive failed with error “Software caused connection abort”
SDK 초기화 코드 및 url 처리 코드는 AppDelegate를 만들어 처리하였습니다.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
//kakao login init
KakaoSDKCommon.initSDK(appKey: APP_KEY, loggingEnable: true)
...
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
//kakao
let kakaoResult = AuthApi.isKakaoTalkLoginUrl(url) ? AuthController.handleOpenUrl(url: url, options: options) : false
...
return kakaoResult
}
카카오 로그인은 ContentView의 Button Action에서 처리하도록 구현하였습니다.
func kakaoLogin(completion: @escaping (String, String) -> Void) {
if(UserApi.isKakaoTalkLoginAvailable()) { //카카오톡 설치된 경우
UserApi.shared.loginWithKakaoTalk { oauthToken, error in
if let error = error {
print(error)
} else {
print(#fileID, #function, #line, "loginWithKakaoTalk() success.")
...
}
}
} else { //카카오톡 미설치인 경우 웹브라우저(사파리)로 인증
UserApi.shared.loginWithKakaoAccount { oauthToken, error in
if let error = error {
print(error)
} else {
print(#fileID, #function, #line, "loginWithKakaoAccount() success.")
...
}
}
}
}
앱 id : 451693
UserApi.shared.loginWithkakaoTalk 호출까지만 되고 이후 print(error) 도 타지 않습니다 ㅜㅜ