2023. 10. 27. 12:01ㆍFrontend/React Native
문제 상황
기존 프로젝트가 리액트 네이티브 0.69.5 버전에서 Xcode 14.1에서 돌아가는 중이었으나 맥 OS의 지속적인 업데이트 정책으로 인해 Xcode15에서도 빌드가 될 수 있도록 개선해야했다.
에러 1. No template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
end
end
end
에러 2. Yogakit 관련 에러
- flipper 관련 코드를 주석처리
- pod 파일에서 flipper 관련 코드 주석처리 후 use framework! 사용
target '앱 이름' do
use_frameworks! :linkage => :static
config = use_native_modules!
# ...
use_react_native!(
# ...
# :flipper_configuration => FlipperConfiguration.enabled,
)
에러 3. React-Codegen 팟 관련 ‘value' is unavailable: introduced in iOS 12.0 error
# post_install do |installer|
# installer.pods_project.targets.each do |target|
# 하단
case target.name
when 'React-Codegen'
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
#12.0 이상으로 올려준다
end
end
# 응용하면 React-Codegen 뿐만 아니라 문제되는 특정 팟의 버전을 특정 버전 이상으로 설정할 수 있다.
에러 4. No permission handler detected.
- permission 관련 에러
- react-native-permissions 패키지가 설치되어있는 상태
- infolist의 항목들도 제대로 썼는 지 체크. 구 버전의 방식을 새 버전의 방식으로 고침
require_relative '../node_modules/react-native-permissions/scripts/setup'
platform :ios, '버전이름'
install! 'cocoapods', :deterministic_uuids => false
setup_permissions([
# 'AppTrackingTransparency',
# 'BluetoothPeripheral',
# 'Calendars',
# 'Camera',
# 'Contacts',
# 'FaceID',
# 'LocationAccuracy',
# 'LocationAlways',
# 'LocationWhenInUse',
# 'MediaLibrary',
# 'Microphone',
# 'Motion',
# 'Notifications',
# 'PhotoLibrary',
# 'PhotoLibraryAddOnly',
# 'Reminders',
# 'Siri',
# 'SpeechRecognition',
# 'StoreKit',
# 사용할 권한 요소만 주석을 풀어주도록 한다.
])
참조자료
Xcode 15 React-Native Troubleshooting Guid https://toyboy2.medium.com/xcode-15-react-native-troubleshooting-guides-e559ac246bae
XCode 15 React-Native Troubleshooting Guides
No template named ‘unary_function’ in namespace ‘std’; did you mean ‘__unary_function’?
toyboy2.medium.com
Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t') when building latest react-native rc with macOS target #834
https://github.com/facebook/flipper/issues/834#issuecomment-900550142