ReactNative

ReactNative_ IOS 빌드 환경 분리

JunsC 2024. 3. 4. 00:24
728x90

IOS swift 를 개발하면서 빌드 환경을 분리해야 할것 같다는 생각이 들었다.

debug , staging , release 3가지 모드를 같이 테스트해야 하는데 자꾸 bundleId 가 중복되어서 삭제하고 다시 까는 일들을 반복적으로 했기 때문에 시간이 걸렸다.

그래서 바로 AOS 빌드환경 분리한 것 처럼 IOS 도 빌드환경을 분리하여 구축하게 되었다.

 

우선 Target -> 프로젝트 에서

User-Defined 에서 BUNDLE_ID_SUFFIX , DISPLAY_NAME 을 만들어서 debug , staging , release 버전에 맞게 명칭을 붙여준다.

 

 

그리고 Product Name 에서 이 프로젝트 이름을 붙여준다 

Product Name 을 클릭하면 

 

 

이렇게 $(TARGET_NAME) 을 넣어서 저장해준다면 알아서 위의 사진처럼 정보가 입력되게 된다.

그리고 밑의 사진처럼 BUNDLE DISPLAY NAME 에도 빌드 환경에 맞게 이름을 지어주는데 밑에는 적용이 안되는 것 같다.

그래서 USER-DEFINED 에서 DISPLAY_NAME 을 따로 만들어 준 것이다.

 

그 DISPLAY_NAME 을 info.plist 에서 $(DISPLAY_NAME) 으로 설정해준다면 빌드 타입에 맞게 앱 이름이 변경된다.

 

 

그리고 저 위 상태까지 진행하고 빌드한다면 에러가 뜨는데 ,

"Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier."

 

Xcode 6 error: "Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier."

I'm trying to build an extension project and Xcode keeps throwing the error in subject. Needless to day, the extension's bundle id is prefixed with app's bundle id. Product Name: ro.chitza.TodayP...

stackoverflow.com

 

그래서 위의 말처럼 위의 사진과 같이 처리를 해주고 

 

header 를 빌드 타입에 맞게 생성만 해주면 debug , staging , release 3가지로 분리가 가능하다.

그리고 ReactNative 에서  명령어를 실행한다면

npx react-native run-ios --device ' 이름 ' --configuration Debug , Staging, Release 
이렇게 실행하면 3가지 빌드타입으로 동시에 확인 가능하다.

 

 

 

 

 

 

그리고 임베디드된 imageNotification 에도 위와 같이 똑같은 적용을 해주어야 한다.

 

추가 Bridging-header 관련 사이트 참고
https://rlogicaltech.medium.com/what-is-a-bridging-header-in-swift-aae3372101fe

 

What is a bridging header in Swift?

You can use Objective-C and Swift files together in a single project, no matter which language the project used originally. This makes…

rlogicaltech.medium.com

 

728x90
"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."