crossplatformkorea / react-native-kakao-login

react-native native module for Kakao sign in.
MIT License
360 stars 136 forks source link

Undefined symbols for architecture arm64 #318

Closed HoJin9622 closed 2 years ago

HoJin9622 commented 2 years ago

Version of kakao-login libraries

4.1.0

Version of react-native

0.68.2

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

IOS

Expected behavior

Archive에 성공한다.

Actual behavior

expo 프로젝트를 eject 후 README INSTALL GUIDE를 순서대로 따라하고 실행하였습니다. 그 후 정상적으로 카카오 로그인이 작동되는 것을 확인했으며 Xcode Archive까지 가능합니다.

Firebase 관련 설정을 추가하려고 @react-native-firebase/analytics @react-native-firebase/app @react-native-firebase/dynamic-links 패키지들을 설치하였습니다. Firebase 설치 관련은 공식문서를 참고하였습니다.

use_frameworks!

./ios/Podfile에 다음 라인을 추가하였습니다.

해당 라인 추가 이후 npx react-native run-ios명령을 실행하면

The following build commands failed:
        Ld /Users/hojin/Library/Developer/Xcode/DerivedData/chabakgaja-clfsbwcuttdlmfcwesjkdgxqkwtg/Build/Products/Debug-iphonesimulator/kakao-login/kakao_login.framework/kakao_login normal (in target 'kakao-login' from project 'Pods')

위와 같은 에러가 발생하였으며

arch -x86_64 npx react-native run-ios 명령으로 실행하면 에뮬레이터에서 정상적으로 실행이 됩니다. 하지만 배포하려고 Xcode Archive 과정에서 에러가 발생하게 됩니다.

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RNKakaoLogins", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Archive 후 나타나는 에러 메시지입니다.

Tested environment (Emulator? Real Device?)

Apple M1 Pro Any iOS Device

시도해본 방법

https://github.com/dooboolab/react-native-iap/issues/14 Proejct Target의 Header Search Paths에 $(SRCROOT)/../../../ios/Pods/Headers/Public 추가

xubmuajkub commented 2 years ago

Same issue

RN Versions:

"react-native": "0.68.2",
"expo": "~45.0.0",

Logs:

› Linking   @react-native-seoul/kakao-login Pods/kakao-login » kakao_login
❌  Undefined symbols for architecture x86_64
┌─ Symbol: _RCTRegisterModule
└─ Referenced from: _initialize_RNKakaoLogins in RNKakaoLogins-20d179d98fbcb8f150db0caa80487581.o
decode33 commented 2 years ago

Add the following on your Podfile


pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

installer.pod_targets.each do |pod| if pod.name.start_with?('kakao-login') def pod.build_type; Pod::BuildType.static_library # get kakao_login static approach instead of dynamic one because of use_frameworks! end end end end

yoonjaehi commented 2 years ago

@decode33 such a genius thanks!

HoJin9622 commented 2 years ago

https://github.com/invertase/react-native-firebase/issues/3024#issuecomment-608451926 해당 이슈를 확인하고 문제 해결하였습니다.

https://rnfirebase.io/#altering-cocoapods-to-use-frameworks 공식문서를 참고하여 ios/Podfile 최상단에 아래 코드를 추가해준 후 정상적으로 실행 및 Archive 되었습니다

$RNFirebaseAsStaticFramework = true