# 설치

## 요구사항 <a href="#requirements" id="requirements"></a>

* React Native version 0.71.8 이상
* **Android:** API 버전 <mark style="color:blue;">**23**</mark> 이상
* **iOS:** API 버전 <mark style="color:blue;">**12.0**</mark> 이상

{% hint style="info" %}
해당 패키지는 Android, iOS 환경에서만 사용 가능합니다. Web, MacOS, Window, Linux 환경에서는 사용할 수 없습니다.&#x20;
{% endhint %}

{% hint style="info" %}
1.0.0 이전 버전에서 설치한 경우에만 확인해주세요.\
v1.0.0 업데이트에는 저장소 키 변경 등 앱 동작에 영향을 줄 수 있는 중요한 변경사항이 포함되어 있습니다. v1.0.0 이전 버전을 사용 중이었다면, 다음 변경 사항을 반드시 먼저 확인해주세요.
{% endhint %}

{% hint style="warning" %}
New Architecture는 아직 지원되지 않습니다
{% endhint %}

#### 저장소 마이그레이션 안내 (v1.0.0 기준) <a href="#storage-migration-notice-from-v1.0.0" id="storage-migration-notice-from-v1.0.0"></a>

* v1.0.0부터 저장소 키 변경 정책이 적용되어, 기존 저장된 데이터에 접근할 수 없는 경우가 발생할 수 있습니다.
* &#x20;키가 유효하지 않은 경우에 한해, 기존 저장 데이터는 자동으로 초기화되고 새 키가 생성됩니다.
* 키가 정상적으로 유지되는 경우, 기존 데이터는 그대로 유지됩니다.
* v1.0.0 이후 버전에서 이전 버전으로 다운그레이드할 경우, 기존 데이터에 접근하지 못할 수 있습니다.

{% hint style="info" %}
업데이트 전에 잠재적인 문제를 방지하기 위해 데이터를 백업해두는 것을 추천드립니다.
{% endhint %}

#### 백업 비활성화 방법 (Android) <a href="#how-to-disable-backup-android" id="how-to-disable-backup-android"></a>

`AndroidManifest.xml` 파일을 다음과 같이 수정하세요:

```xml
<application
    android:allowBackup="false"
    android:fullBackupContent="false">
```

`android:allowBackup`이 `true`로 설정되어 있으면, 마이그레이션 과정이 정상적으로 동작하지 않아 **데이터 손실** 또는 **저장소 문제**가 발생할 수 있습니다.

## 설치하기 <a href="#installation" id="installation"></a>

Wepin React Native SDK 를 설치하는 방법을 설명합니다.

### Wepin 설치하기

Wepin React Native SDK 는 npm 패키지로 설치 가능합니다.

{% tabs %}
{% tab title="npm" %}

```bash
npm install @wepin/login-rn
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @wepin/login-rn
```

{% endtab %}
{% endtabs %}

### peerDependencies

```bash
npm install react-native-device-info

# for ios
cd ios
pod install
```

or

```bash
yarn add react-native-device-info

# for ios
cd ios 
pod install
```

### react-native.config.js 설정 <a href="#react-native.config.js-setting" id="react-native.config.js-setting"></a>

react-native.config.js 파일에 @wepin/storage-rn 경로를 설정해주어야 합니다.

```javascript
const path = require('path');
module.exports = {
  dependencies: {
    '@wepin/storage-rn': {
      root: path.join(__dirname, './node_modules/@wepin/storage-rn'),
    },
  },
};
```

#### iOS Podfile 설정

Xcode 26.0.1 이상 버전 사용 시 빌드 에러가 발생할 수 있습니다.

> error Unable to find module dependency: 'bcrypt' (in tarrget 'WepinLogin' from project 'Pods')

위와 같은 에러가 발생하는 경우 Podfile 에 아래 코드를 추가해주세요.

```
post_install do |installer| 
  installer.pods_project.targets.each do |target| 
    target.build_configurations.each do |config| 
      config.build_settings['SWIFT_ENABLE_EXPLICIT_MODULES'] = 'NO' 
    end 
  end 
end
```
