다음을 통해 공유


React Native SDK 문제 해결

중요합니다

Visual Studio App Center는 2026년 6월 30일까지 계속 지원되는 분석 및 진단 기능을 제외하고 2025년 3월 31일에 사용 중지되었습니다. 자세히 알아보기.

'React/RCTDefines.h' 파일을 찾을 수 없음

이 오류는 RN 핵심 라이브러리가 올바르게 참조되지 않을 때 나타나며, 이는 다양한 종류의 통합 또는 연결 문제로 인해 발생할 수 있습니다. 프로젝트에서 종속성을 정적으로 연결하지 않고 podfile의 상대 경로를 사용하여 연결할 경우, 이러한 일이 종종 발생합니다.

연결 스크립트는 Pod를 연결하는 표준 방법만을 지원하므로 문제를 해결하려면 다음을 수행하십시오.

  1. 사용자 Podfile 내의 의존성을 상대적 연결 경로로 변경하십시오.

    전에:

    pod 'AppCenter/Analytics', '~> 1.14.0'
    pod 'AppCenter/Crashes', '~> 1.14.0'
    pod 'AppCenterReactNativeShared', '~> 1.13.0'
    

    이후:

    pod 'appcenter', path: '../node_modules/appcenter/ios'
    pod 'appcenter-analytics', path: '../node_modules/appcenter-analytics/ios'
    pod 'appcenter-crashes', path: '../node_modules/appcenter-crashes/ios'
    
  2. pod install 폴더에서 iOS을(를) 실행합니다.

  3. AppDelegate.m 내에서 가져오기를 바꿉니다.

    전에:

    #import <AppCenterReactNative/AppCenterReactNative.h>
    #import <AppCenterReactNativeAnalytics/AppCenterReactNativeAnalytics.h>
    #import <AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.h>
    

    이후:

    #import "AppCenterReactNative.h"
    #import "AppCenterReactNativeAnalytics.h"
    #import "AppCenterReactNativeCrashes.h"
    
  4. 프로젝트에서 AppCenter 종속성을 제거합니다(종속성 제거 종속성을 > 마우스 오른쪽 단추로 클릭).

    • YOUR_APP< -Libraries를 선택하고> 다음 파일을 제거>.
      • AppCenterReactNative.xcodeproj
      • AppCenterReactNativeAnalytics.xcodeproj
      • AppCenterReactNativeCrashes.xcodeproj
    • 프로젝트 설정을 열고 연결된 프레임워크 및 라이브러리 섹션의 일반 탭에서 이전 단계에서 제거된 대상 라이브러리를 참조하는 새 항목을 제거합니다.
      • libAppCenterReactNative.a
      • libAppCenterReactNativeAnalytics.a
      • libAppCenterReactNativeCrashes.a
    • 헤더 검색 경로를 수정하여 AppCenter React 네이티브 플러그 인 프로젝트에서 헤더를 제거합니다. 프로젝트 설정을 열고 헤더 검색 경로 섹션의 빌드 설정 탭에서 헤더 파일에 대한 다음 위치를 제거합니다.
      • $(SRCROOT)/../node_modules/appcenter/ios/AppCenterReactNative
      • $(SRCROOT)/../node_modules/appcenter-analytics/ios/AppCenterReactNativeAnalytics
      • $(SRCROOT)/../node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes

컴퓨터에 yarn가 설치되어 있는 경우, react-native init {myapp}가 당신의 앱을 초기화하고 yarn 대신 npm를 사용하여 종속성을 설치할 것입니다. 실행할 react-native link 때 다음 오류 메시지가 표시되면, npm install {package} 대신 yarn add {package}에서 App Center 종속성이 설치되어 npmyarn가 설치 중에 혼합됩니다.

Command `link` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.

이 경우 npm install을(를) 실행하고 react-native link을(를) 다시 시도하십시오.

'AppCenterCrashes/MSACErrorReport.h' 파일과 같은 빌드 오류를 찾을 수 없습니다.

React-Native 0.60 이상

가능한 원인은 Apple SDK의 호환성이 손상되는 변경으로 인해 주요 패키지 버전 간의 충돌입니다.

  1. 모든 appcenter 패키지가 동일한 주 버전을 사용하는지 확인합니다. npm install 또는 yarn로 필요한 경우 업데이트하십시오.

  2. 프로젝트의 ios 폴더로 이동하여 Podfile.lockPods 폴더를 제거합니다.

  3. ios 폴더에서 pod install --repo-update를 실행합니다.

  4. Podfile.lock에 동일한 주 버전의 종속성이 포함되어 appcenter 있는지 확인합니다.

React Native가 0.60보다 낮음

한 가지 가능한 원인은 react-native link 설치하지 않고 실행할 때입니다.

원인을 확인하려면 실행 react-native link한 다음 로그에서 다음 줄을 확인합니다.

Could not configure AppCenter for iOS. Error Reason - spawn pod ENOENT

이 줄은 로그의 다음 섹션에 있습니다.

Added code to initialize iOS AppCenter SDK in ios/TestApp/AppDelegate.m
Installing Cocoapods dependencies...
Could not configure AppCenter for iOS. Error Reason - spawn pod ENOENT
rnpm-install info Platform 'ios' module appcenter-analytics is already linked
rnpm-install info Platform 'android' module appcenter-analytics is already linked

이 오류가 표시되면 시스템의 pod 환경 변수에서 CocoaPods의 명령을 사용할 수 있는지 확인 합니다.

CocoaPods 설치를 수정한 후 pod install 폴더에서 실행 하여 프로젝트를 수정합니다.

만약 react-native link 동안 다음과 같은 CocoaPods 오류 메시지가 표시된다면, 컴퓨터의 ~/.cocoapods/repos의 로컬 클론()이 최신 상태가 아닐 가능성이 있습니다.

Analyzing dependencies [!] Unable to find a specification for AppCenterReactNativeShared (~> {version})

실행 pod repo update 하여 사양 리포지토리를 업데이트하고 다시 시도합니다 react-native link . CocoaPods 명령에 대한 자세한 내용은 CocoaPods 명령줄 참조를 참조하세요.

App Center SDK를 사용하여 앱을 React Native 0.59에서 0.60으로 업그레이드하는 방법

React Native를 버전 0.60.0으로 업그레이드하려면 다음 명령을 사용합니다.

react-native upgrade 0.60.0

비고

업그레이드하는 동안 이 오류가 Command failed: git status -s fatal: not a git repository (or any of the parent directories): .git발생하면 다음 단계를 수행합니다.

git init
git add .
git commit -m "Upgrade react-native"

업그레이드를 완료한 후 .git 디렉터리를 제거할 수 있습니다.

React Native iOS 업데이트

  1. Podfile을 열고 다음 줄에서 App Center 종속성을 바꿉다.

    use_native_modules!
    
  2. 다음 명령을 실행합니다.

    pod repo update
    

React Native SDK를 최신 버전으로 업데이트하는 방법

SDK를 애플리케이션에 이미 통합했으며 최신 버전의 SDK로 업그레이드하려는 경우 다음 단계에 따라 업그레이드합니다.

  1. npm uninstall --save appcenter appcenter-analytics appcenter-crashes 이전 App Center 패키지를 제거합니다.

  2. npm install --save-exact appcenter appcenter-analytics appcenter-crashes 최신 App Center 패키지를 설치합니다.

  3. pod repo update CocoaPods 사양 리포지토리가 최신 상태인지 확인합니다.

  4. react-native link;

팁 (조언)

다음 react-native linkCocoaPods 오류 메시지와 유사한 오류 메시지가 표시되는 경우 ios 폴더에서 자동 생성된 Podfile.lock을 삭제하고 다시 실행 react-native link 합니다.

[!] Unable to satisfy the following requirements:

- `AppCenter/Core (= 1.0.0)` required by `Podfile.lock`
- `AppCenter/Core (= 1.0.0)` required by `AppCenter/Crashes (1.0.0)`
- `AppCenter/Core (= 1.0.0)` required by `AppCenter/Analytics (1.0.0)`
- `AppCenter/Core (= 1.0.1)` required by `AppCenterReactNativeShared (1.0.1)`

jCenter에서 Maven Central로 마이그레이션

jCenter 지원 종료로 인해 모든 어셈블리가 Maven Central 리포지토리로 이동되었습니다. App Center를 사용하려면 아래와 같이 Gradle 파일의 리포지토리에 추가 mavenCentral() 해야 합니다.

repositories {
   google()
   mavenCentral()
}

App Center 비밀 값 보호

app_secret 의 식별자이며 트래픽이 적용되는 앱을 알아야 하며 기존 데이터를 검색하거나 편집하는 데 사용할 수 없습니다. app_secret 노출되는 경우 가장 큰 위험은 잘못된 데이터를 앱에 보내는 것이지만 데이터의 보안에는 영향을 주지 않습니다.

중요한 데이터를 검색하려면 클라이언트 쪽에서 생성되는 앱/사용자 토큰을 제공해야 합니다. 클라이언트 쪽의 데이터를 완전히 안전하게 만들 수 있는 방법은 없습니다.

환경 변수를 사용하여 앱 비밀을 코드에 삽입하여 앱의 보안을 향상시킬 수 있습니다. 이렇게 하면 코드에 비밀이 표시되지 않습니다.