React Native Beginner 03 Real-Computer Debugging (IOS)accessing the development server from a device
With the development server enabled, you can quickly iterate to modify the app and then view the results on the device. The premise is that your computer and device must be in the same WiFi environment.
Open AwesomeApp/ios/AwesomeApp/AppDelegate.m The URL in the change and change localhost to the IP of your computer. Under the Mac system, you can find the IP address of your computer in the system settings/network.
eg
Jscodelocation = [Nsurl urlwithstring:@ "Http://192.168.1.107:8081/index.ios.bundle?platform=ios&dev=true"];
Select your device as the running target in Xcode and click Build and Run.
using offline Packages
When you run the app on a real machine, all JavaScript code and pictures are automatically packaged inside the app. This can be run out of the development server and eventually submitted to AppStore for publishing.
Requires a new version of xcode7.3, no developer account required, only AppleID generate certificates.
Open AWESOMEAPP/IOS/AWESOMEAPP/APPDELEGATE.M Uncomment jscodelocation = [[NSBundle mainbundle] ... This line.
eg
Real-Machine debugging
Jscodelocation = [[NSBundle Mainbundle] urlforresource:@ "main" withextension:@ "Jsbundle"];
Depending on the scheme chosen by your app, different offline packages will be generated (debug generates a package with a warning development pattern, and release generates a compressed-optimized package). To modify Scheme, select Product > Scheme > Edit scheme ... in the top menu of Xcode, switch to debug or release in the build configuration option. Only analyze and run are checked in the build.
Baidu Cloud Disk
React Native Technology Exchange Group 127482131, you are welcome to study RN together.
Reprint please keep the article link http://www.reactnative.pw/
React native Novice Learning route 03 Real Machine debugging