crossplatformkorea / react-native-kakao-login

react-native native module for Kakao sign in.
MIT License
350 stars 133 forks source link

프로필 데이터중 사진이 null로 표시됩니다. #252

Open saladsoft opened 2 years ago

saladsoft commented 2 years ago

Version of kakao-login libraries

3.3.2

Version of react-native

0.64.2

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

Actual behavior

안녕하세요. getProfile을 실행하여 정상적으로 프로필 데이터를 취득하고 있습니다만, 사진관련 데이터가 null로 표시가 되고 있습니다. profileImageUrl: null,

관련하여 xcode에서의 리스폰스를 보면 정상적으로 취득이 되는것을 확인하였습니다. 혹시 제가 놓치고 있는게 있을런지요?

조언 부탁드리겠습니다.

Tested environment (Emulator? Real Device?)

실제 아이폰 에서 실행하였습니다.

libelize commented 2 years ago

저도 3.3.3 버전에서 iOS 만 프로필 사진을 null 로 주고 있습니다. 이 문제를 해결할 방법이 있는건가요?

JJalit commented 2 years ago

저도 그렇습니다 gender, ageRage, 프로필 url 모두 null로 뜹니다

geotwo-JinsolLee commented 2 years ago

저도 그렇습니다. 일단 업데이트가 안되있는 상태이기 때문에 임시적으로 해결한 방법을 공유드리겠습니다.

react 부분에서 처리 되지 않는 이유는 react 에서 swift의 URL 을 컨버팅을 하지 못해서 생기는 이슈라고 생각하지만 정확하진 않습니다;;

RNKakaoLogins.swift 코드 내의


@objc(getProfile:rejecter:)
    func getProfile(_ resolve: @escaping RCTPromiseResolveBlock,
               rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
        DispatchQueue.main.async {
            UserApi.shared.me() {(user, error) in
                if let error = error {
                    reject("RNKakaoLogins", error.localizedDescription, nil)
                }
                else {
                    print(user?.kakaoAccount?.profile?.profileImageUrl!.absoluteString as Any);
                    resolve([
                        "id": user?.id as Any,
                        "email": user?.kakaoAccount?.email as Any,
                        "nickname": user?.kakaoAccount?.profile?.nickname as Any,
                        "profileImageUrl": user?.kakaoAccount?.profile?.profileImageUrl!.absoluteString as Any, // 변경
                        "thumbnailImageUrl": user?.kakaoAccount?.profile?.thumbnailImageUrl as Any,
                        "phoneNumber": user?.kakaoAccount?.phoneNumber as Any,
                        "ageRange": user?.kakaoAccount?.ageRange as Any,
                        "birthday": user?.kakaoAccount?.birthday as Any,
                        "birthdayType": user?.kakaoAccount?.birthdayType as Any,
                        "birthyear": user?.kakaoAccount?.birthyear as Any,
                        "gender": user?.kakaoAccount?.gender as Any,
                        "isEmailValid": user?.kakaoAccount?.isEmailValid as Any,
                        "isEmailVerified": user?.kakaoAccount?.isEmailVerified as Any,
                        "isKorean": user?.kakaoAccount?.isKorean as Any,
                        "ageRangeNeedsAgreement": user?.kakaoAccount?.ageRangeNeedsAgreement as Any,
                        "birthdayNeedsAgreement": user?.kakaoAccount?.birthdayNeedsAgreement as Any,
                        "birthyearNeedsAgreement": user?.kakaoAccount?.birthyearNeedsAgreement as Any,
                        "emailNeedsAgreement": user?.kakaoAccount?.emailNeedsAgreement as Any,
                        "genderNeedsAgreement": user?.kakaoAccount?.genderNeedsAgreement as Any,
                        "isKoreanNeedsAgreement": user?.kakaoAccount?.isKoreanNeedsAgreement as Any,
                        "phoneNumberNeedsAgreement": user?.kakaoAccount?.phoneNumberNeedsAgreement as Any,
                        "profileNeedsAgreement": user?.kakaoAccount?.profileNeedsAgreement as Any,
                    ])
                }
            }
        }
    }

// 변경 을 하시면 profile image 가 정상적으로 받아오는 걸 확인 하 실 수 있습니다. 변수가 URL 인것들도 마찬가지로 변경하셔서 빌드하시면됩니다.

다른 파라미터들도 출력되지 않는 이유또한 동일 할 것으로 판단됩니다.

minsoo-web commented 2 years ago

저도 그렇습니다. 일단 업데이트가 안되있는 상태이기 때문에 임시적으로 해결한 방법을 공유드리겠습니다.

react 부분에서 처리 되지 않는 이유는 react 에서 swift의 URL 을 컨버팅을 하지 못해서 생기는 이슈라고 생각하지만 정확하진 않습니다;;

RNKakaoLogins.swift 코드 내의


@objc(getProfile:rejecter:)
    func getProfile(_ resolve: @escaping RCTPromiseResolveBlock,
               rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
        DispatchQueue.main.async {
            UserApi.shared.me() {(user, error) in
                if let error = error {
                    reject("RNKakaoLogins", error.localizedDescription, nil)
                }
                else {
                    print(user?.kakaoAccount?.profile?.profileImageUrl!.absoluteString as Any);
                    resolve([
                        "id": user?.id as Any,
                        "email": user?.kakaoAccount?.email as Any,
                        "nickname": user?.kakaoAccount?.profile?.nickname as Any,
                        "profileImageUrl": user?.kakaoAccount?.profile?.profileImageUrl!.absoluteString as Any, // 변경
                        "thumbnailImageUrl": user?.kakaoAccount?.profile?.thumbnailImageUrl as Any,
                        "phoneNumber": user?.kakaoAccount?.phoneNumber as Any,
                        "ageRange": user?.kakaoAccount?.ageRange as Any,
                        "birthday": user?.kakaoAccount?.birthday as Any,
                        "birthdayType": user?.kakaoAccount?.birthdayType as Any,
                        "birthyear": user?.kakaoAccount?.birthyear as Any,
                        "gender": user?.kakaoAccount?.gender as Any,
                        "isEmailValid": user?.kakaoAccount?.isEmailValid as Any,
                        "isEmailVerified": user?.kakaoAccount?.isEmailVerified as Any,
                        "isKorean": user?.kakaoAccount?.isKorean as Any,
                        "ageRangeNeedsAgreement": user?.kakaoAccount?.ageRangeNeedsAgreement as Any,
                        "birthdayNeedsAgreement": user?.kakaoAccount?.birthdayNeedsAgreement as Any,
                        "birthyearNeedsAgreement": user?.kakaoAccount?.birthyearNeedsAgreement as Any,
                        "emailNeedsAgreement": user?.kakaoAccount?.emailNeedsAgreement as Any,
                        "genderNeedsAgreement": user?.kakaoAccount?.genderNeedsAgreement as Any,
                        "isKoreanNeedsAgreement": user?.kakaoAccount?.isKoreanNeedsAgreement as Any,
                        "phoneNumberNeedsAgreement": user?.kakaoAccount?.phoneNumberNeedsAgreement as Any,
                        "profileNeedsAgreement": user?.kakaoAccount?.profileNeedsAgreement as Any,
                    ])
                }
            }
        }
    }

// 변경 을 하시면 profile image 가 정상적으로 받아오는 걸 확인 하 실 수 있습니다. 변수가 URL 인것들도 마찬가지로 변경하셔서 빌드하시면됩니다.

다른 파라미터들도 출력되지 않는 이유또한 동일 할 것으로 판단됩니다.

저는 이 방법으로 해결했습니다. 감사합니다!

okinawaa commented 2 years ago

이메일이 null 인 오류는 이 방법도 안통하네요 ㅠ!