Notes on the development of react native

Source: Internet
Author: User



Today, when I was writing a simple RN demo, there were several mistakes, and finally I was able to solve the problem by sharing the pits and solutions I had stepped on:



1. An error occurred running: Could not connect to Development server.






Workaround:



Please put the APPDELEGATE.M in the project in the


Jscodelocation = [Nsurl urlwithstring:@ "http://localhost:8081/index.ios.bundle?platform=ios&dev= True"];

 


Switch


Jscodelocation = [Nsurl urlwithstring:@ "http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev= True"];

 


Cause: Do the local Area network development environment, most will do server mapping processing, localhost is pointing to a specific IP instead of native 127.0.0.1, this problem will occur.



2. "Unable to resolve module XXX from ..." in react native



There are two reasons for this error, one is that your dependency is not fully installed, and the other is that the code in your file is not written, such as the English letter is wrong.



If the dependency is not installed, you can refer to the following command:


NPM i XXX--save or NPM install

 


Then turn off the terminal and run it again.



3.IOS9 HTTPS mechanism to connect the network method:


First add the nsapptransportsecurity type dictionary in Info.plist. Then add the Nsallowsarbitraryloads type Boolean under Nsapptransportsecurity, The value is set to Yes.

 





4. Remember, most of my mistakes are the code is wrong, incredibly find a half-day reason, laugh and cry ...






Notes on the development of react native


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.