보안 설정이 맞지만 React Native 앱이 어떤 이유로 (iOS 기기 또는 시뮬레이터에서 실행 중일 때도) 서버에 연결되지 않습니다.iOS 앱 전송 보안 : Info.plist에서 특정 IP 주소 허용
서버 (IP 주소 및 포트)는 네트워크에서 볼 수 있으므로 NSAppTransportSecurity
(Info.plist
)으로 인한 오류 일 수 있습니다. 그것을 다시 시작하는 것은 도움이되지 않습니다.
해결 방법은 주소를 여는 데 NSAllowsArbitraryLoads
에서 true
으로 설정하는 것입니다. 내가 아는 한, 모든 IP 주소를 노출하므로 피해야합니다.
NSExceptionDomains
은 IP 주소가 아닌 도메인 이름으로 만 작동하는 것 같습니다.
10.10.0.16
및 localhost
개의 IP 주소를 열고 다른 모든 주소를 차단하는 방법은 무엇입니까?
앱 운송 보안 설정 :
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>10.10.0.16</key>
<dict>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
콘솔 로그 :
2016-07-26 17:14:26.803 RNProject[80649:678556] NSMainNibFile and UIMainStoryboardFile are both set. NSMainNibFile ignored.
2016-07-26 17:14:26:936 RNProject[80649:678556] styleString = styleFile
2016-07-26 17:14:27.005 RNProject[80649:678837] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2016-07-26 17:14:27.021 RNProject[80649:678556] INFO: Reveal Server started (Protocol Version 25).
2016-07-26 17:14:27.035 RNProject[80649:678556] Reachability: Reachable via WiFi
2016-07-26 17:14:27.035 RNProject[80649:678556] Reach = Reachability: Reachable via WiFi
2016-07-26 17:14:27.036 [fatal][tid:main] Could not connect to development server.
Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
URL: http://10.10.0.16:8081/index.ios.bundle?platform=ios&dev=true
이번 주에 나에게 이런 일이 생기기 시작했습니다. 그것은 iOS 10.2 이상에서 발생하는 것 같습니다. 최신 문서 인 "임시"라는 단어는 더 이상 키 이름에 사용되지 않습니다. https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33 그러나 키 이름을 수정해도 문제가 해결되지 않았습니다. 문제. 앱이 도메인 목록을 무시하는 것으로 보입니다. –