React Native iOS 문제 해결
Xcode 빌드 오류 (1) Undefined symbols for architecture arm64: “OBJC_CLASS$_AppSealingInterface”
Section titled “Xcode 빌드 오류 (1) Undefined symbols for architecture arm64: “OBJC_CLASS$_AppSealingInterface””이 링커 오류는 AppSealing 라이브러리가 프로젝트에 제대로 링크되지 않았을 때 발생합니다.
해결 방법:
Section titled “해결 방법:”-
라이브러리 파일 확인
AppsealingiOS.mm
파일이 Xcode 프로젝트에 포함되어 있는지 확인libhermes.a
(AppSealing 버전) 파일이 올바른 위치에 있는지 확인
-
Other Linker Flags 설정
- Build Settings > Other Linker Flags에 다음 추가:
-lAppSealing-force_load $(PROJECT_DIR)/AppSealing/libhermes.a -
Header Search Paths 설정
- Build Settings > Header Search Paths에 AppSealing 폴더 경로 추가:
$(PROJECT_DIR)/AppSealing
Xcode 빌드 오류 (2) Module ‘AppSealingModule’ not found
Section titled “Xcode 빌드 오류 (2) Module ‘AppSealingModule’ not found”React Native 브리지 모듈을 찾을 수 없다는 오류입니다.
해결 방법:
Section titled “해결 방법:”-
모듈 파일 확인
AppSealingModule.h
와AppSealingModule.m
파일이 Xcode 프로젝트에 추가되어 있는지 확인
-
브리지 헤더 설정
- Swift 프로젝트의 경우 Bridging Header에 다음 추가:
#import "AppSealingModule.h" -
모듈 등록 확인
AppSealingModule.m
에서RCT_EXPORT_MODULE()
매크로가 있는지 확인
React Native 런타임 오류 (1) Cannot read property ‘getDeviceId’ of undefined
Section titled “React Native 런타임 오류 (1) Cannot read property ‘getDeviceId’ of undefined”JavaScript에서 네이티브 모듈에 접근할 수 없다는 오류입니다.
해결 방법:
Section titled “해결 방법:”-
모듈 가져오기 확인
import {NativeModules} from 'react-native';const {AppSealingModule} = NativeModules;// 모듈이 제대로 로드되었는지 확인console.log('AppSealingModule:', AppSealingModule); -
iOS 시뮬레이터 재시작
- 메뉴에서 Device > Erase All Content and Settings
- Xcode에서 Clean Build Folder 수행
-
Metro 번들러 재시작
Terminal window npx react-native start --reset-cache
Hermes 관련 오류 (1) Hermes engine not enabled
Section titled “Hermes 관련 오류 (1) Hermes engine not enabled”Hermes 엔진이 활성화되지 않은 상태에서 AppSealing을 사용하려고 할 때 발생합니다.
해결 방법:
Section titled “해결 방법:”-
Podfile 확인
use_react_native!(:path => config[:reactNativePath],:hermes_enabled => true) -
Hermes 설정 확인
// 앱에서 Hermes가 활성화되었는지 확인const isHermes = () => !!global.HermesInternal;console.log('Hermes enabled:', isHermes()); -
Pod 재설치
Terminal window cd iosrm -rf Pods Podfile.lockpod install
런타임 오류 (1) 앱이 20초 후 종료됨
Section titled “런타임 오류 (1) 앱이 20초 후 종료됨”Release 모드에서 보안 탐지로 인해 앱이 자동 종료되는 경우입니다.
해결 방법:
Section titled “해결 방법:”-
개발 중에는 Debug 모드 사용
- Xcode에서 Debug 스킴으로 빌드
- Release 모드는 TestFlight나 App Store에서만 테스트
-
번들 ID 확인
- Xcode 프로젝트의 Bundle Identifier가 ADC에서 등록한 ID와 일치하는지 확인
-
로그 확인
- Xcode Console에서 AppSealing 관련 로그 메시지 확인
- “FAILED( Not registered bundle name )” 메시지가 있는지 확인
Metro 번들러 오류 (1) Unable to resolve module
Section titled “Metro 번들러 오류 (1) Unable to resolve module”React Native가 필요한 모듈을 찾지 못하는 경우입니다.
해결 방법:
Section titled “해결 방법:”-
node_modules 재설치
Terminal window rm -rf node_modulesnpm install# 또는yarn install -
Metro 캐시 클리어
Terminal window npx react-native start --reset-cache -
iOS 특정 의존성 재설치
Terminal window cd iospod install
네이티브 모듈 Promise 오류
Section titled “네이티브 모듈 Promise 오류”네이티브 모듈에서 Promise가 제대로 처리되지 않는 경우입니다.
해결 방법:
Section titled “해결 방법:”-
Promise 처리 확인
try {const result = await AppSealingModule.getDeviceId();console.log('Device ID:', result);} catch (error) {console.error('Error:', error);} -
네이티브 구현 확인
RCT_EXPORT_METHOD(getDeviceId:(RCTPromiseResolveBlock)resolverejecter:(RCTPromiseRejectBlock)reject){// resolve() 또는 reject() 호출 확인}
빌드 최적화 팁
Section titled “빌드 최적화 팁”클린 빌드 수행
Section titled “클린 빌드 수행”# iOS 클린 빌드cd iosrm -rf build/xcodebuild clean
# React Native 클린 빌드npx react-native start --reset-cache
캐시 완전 삭제
Section titled “캐시 완전 삭제”# 모든 캐시 삭제rm -rf node_modulesrm -rf ios/Podsrm -rf ios/buildrm -rf ios/Podfile.lockrm package-lock.json
# 재설치npm installcd ios && pod install
디버깅 도구
Section titled “디버깅 도구”네이티브 모듈 디버깅
Section titled “네이티브 모듈 디버깅”// 네이티브 모듈이 로드되었는지 확인console.log('Available native modules:', Object.keys(NativeModules));
// AppSealing 모듈 메서드 확인console.log('AppSealing methods:', Object.keys(NativeModules.AppSealingModule || {}));
Xcode 디버깅
Section titled “Xcode 디버깅”- Xcode Console에서 NSLog 메시지 확인
- Breakpoint를 설정하여 네이티브 코드 디버깅
- Product > Scheme > Edit Scheme에서 Debug Information Format 확인
지원 및 문의
Section titled “지원 및 문의”문제가 지속되는 경우:
- 로그 수집: Xcode Console과 Metro 번들러의 전체 로그
- 환경 정보: React Native 버전, Xcode 버전, iOS 버전
- 재현 단계: 문제가 발생하는 정확한 단계
- DoveRunner Mobile App Security 지원팀 문의: 수집한 정보와 함께 헬프 센터로 문의