inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

배달앱 클론코딩 [with React Native]

react-native-config 문제 해결하기

아이폰으로 회원가입

553

장산

작성한 질문수 46

0

안녕하세요 제로초님 아이폰으로 회원가입 할려는데

안드로이드는 잘되지만 아이폰만 안되서 질문 드립니다

강의 교안 보고 Podfile에 pod 'react-native-config', :path => '../node_modules/react-native-config/react-native-config.podspec' 추가해보기 해봤는데

회원가입이 안되고 로그에 undefined가 계속 뜨네요

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
pod 'react-native-config', :path => '../node_modules/react-native-config/react-native-config.podspec'
target 'FoodDeliveryApp' do
  config = use_native_modules!
  
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'FoodDeliveryAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

여기에 추가하는게 맞나요?

react-native

답변 1

0

제로초(조현영)

아이폰에서 백엔드 ip 뭘로 하셨나요?

0

장산

API_URL = http://192.168.x.x:3105

따로 설정하지는 않았지만 게시물 보고 맥북=>설정=> 네트워크에서 ip주소 가져온것으로 했습니다!

0

제로초(조현영)

아이폰 시뮬레이터인가요? 사파리에서 그 백엔드 주소 입력해보세요.

0

장산

ok라고 뜹니다! 그러면 잘된다는것인데...

아 위에 ip로 하니까 이번에는 안드로이드가 안됩니다 흠

0

제로초(조현영)

axios 요청보내는 곳에서 api url이 undefined 뜨는건가요?

0

장산

try {
      setLoading(true);
      const response = await axios.post(`${Config.API_URL}/user`, {
        email,
        name,
        password,
      });
      console.log('이메일이름비번',response.data);
      setLoading(false);
      Alert.alert("알림", "회원가입 되었습니다");
      navigation.navigate("SignIn");
    } catch (error) {
      //error는 unknown이라서 실제로 뭔지 모르기때문에 사용할때 한번 지정해줘야함
      const errorResponse = (error as AxiosError).response;
      console.log("error2", errorResponse);
      if (errorResponse) {
        Alert.alert("알림", errorResponse.data.message);
      }
    } finally {
      setLoading(false);
    }
    Alert.alert("알림", "회원가입 되었습니다.");
  }, [loading, navigation, email, name, password]);errorResponse

errorResponse가 undifined뜹니다

0

제로초(조현영)

error reponse말고 error를 찍어보세요. 그리고 api url도요

0

장산

url을  http://10.0.2.2:3105 으로 했을경우

안드로이드는 url이  http://10.0.2.2:3105 로 뜨고

프론트에러는 아래것이 뜨지만 백엔드에는 성공했다고 뜨면서 로그인창으로 넘어가집니다

스크린샷 2023-05-23 오전 12.55.40.pngios는 url이 http://10.0.2.2:3105 뜨고

[Error: timeout exceeded] 이에러가 뜨면서 회원가입 되었습니다라고 알림창은 뜨는데 백엔드는 반응이 없습니다

0

제로초(조현영)

ios는 api url 192로 시작해야하는 겁니다.

1

장산

아그럼 .env에서 192로 바꿔도  http://10.0.2.2:3105 로그창에 이렇게 뜨네요

 

1

제로초(조현영)

캐시같은게 남아있는것 같은데 xcode에서 build에서 cache clean하고 다시 빌드해야할 것 같네요.

0

장산

xcode에서 product메뉴에서 clean build folder 하고 다시 빌드 했더니 성공했습니다! 감사합니다!

앱실행시 네이버맵 [401] 에러

0

986

2

스타일링 라이브러리

0

147

2

expo, cli 선택 중에 고민이 있습니다.

0

167

2

JDK 버전이 달라도 괜찮나요?

0

223

2

dimenstion usewindowdeminstion

0

121

3

[맥 전용]환경 설정하기 1편 & [맥 전용]환경 설정하기 2편의 영상이 안나옵니다.

0

210

1

jdk11 버전과 gradle 버전의 호환성 관련 질문드립니다.

0

399

2

강의 외 질문입니다!

0

157

2

react native랑 맞는 ui 라이브러리 어떤게 좋을까요?

0

1498

2

react native와 spring boot 연결

0

355

1

java가 아닌 .kt에서 code push 에러가 발생합니다.

0

214

2

flipper 239 에러가 발생합니다.

0

165

2

package.json에 /lib/panino.js 문제입니다.

0

470

2

window - mac 협업 과정 질문합니다

0

215

1

ios 빌드 중 RCTBridgeDelegate.h import 오류

0

289

2

ios 앱 빌드 중 hermesEnabled 관련 오류발생

0

239

2

Socket 연결시 질문 드립니다.!

0

152

2

wifi 환경에서 axios 통신이 로컬서버에서 안됩니다.

0

426

2

iOS render error 질문드립니다.

0

410

2

iOS 가상머신 오류

0

165

2

npc react init 명령어 실행시 발생되는 오류

0

220

1

nom start 시 오류

0

116

1

NextJS 기반으로 만들어서 웹뷰 React Native로 배포 가능한가요?

0

1001

2

안드로이드 rn75 버전에 맞게 설정 중에 android13 다운로드에 대해서 막혔습니다!

0

184

2