The original address, here. Chinese translation version, here.
Here to sort out the problems that are encountered
1, the specified root parameter is not in effect, the form: Unable to obtain the Index.ios.boundle file.
Workaround: Where document commands
Js_dir= ' pwd '/reactcomponent; CD pods/react; NPM run start----root $JS _dir
The root address could not be set correctly, tracing the start call version, and finally the call. /react-native/packager/packager.js. The startup mode is changed to
Js_dir= ' pwd '/reactcomponent; Cd.. /react-native/packager; Node Packager.js--root $JS _dir
(1) Ensure that the path to execute the script must be in the path of the project.
(2) Ensure that the packager path to React-native is entered according to the CD command.
(3) After the problem, according to the structure of their own project to modify the script, this is a development of the most basic ability.
2, pods dependence problem. Presentation: No more items can be used for the underlying class, libreact is not normally produced in Podlib, or the item appears rctrootview not fount.
Workaround: Correct configuration in Podfile
#React now Version:0.11.0-rcpod ' React ',:p ath = './react-native ',: subspecs = [' Core ', ' ART ', ' Rctactionshee T ', ' rctadsupport ', ' rctgeolocation ', ' rctimage ', ' rctnetwork ', ' rctpushnotification ', ' rctsettings ', ' rcttext ', ' Rctvibration ', ' rctwebsocket ', ' Rctlinkingios ',] #需要的模块依赖进来便可, here is to give an example, enumerate all the modules
It is important to note:p ath = './react-native ' This path corresponds to the relative path of your podfile, which can be locally dependent on the react-native in the local flag network, usually under the ZIP package decompression. /node_modules/react-native (this folder can be found in example according to the latest version downloaded from the website)
The problem solution of the pod install is too slow: Pod install--verbose--no-repo-update.
The workaround for pod install cannot be downloaded properly (or update the latest CocoaPods version:0.39.0 viewing method pod--version):
Gem sources--remove Https://rubygems.org/gem sources-a gem sources-l #注意 Taobao is https; gem if version is too old to update: sudo gem update --system updating pod repo:pod repo update
View The version of react-native in CocoaPods current repo
Pod Search React #目前的最新版本: 0.11.0-RC #Versions: 0.11.0-RC, 0.10.0, 0.10.0-RC, 0.9.0, 0.9.0-RC, 0.8.0, 0.8.0-rc.2, 0.8.0-RC, 0.7.1, 0.7.0-rc.2, 0.6.0, 0.6.0-RC, 0.5.0, 0.4.4, 0.4.3, 0.4.2,# 0.4.1, 0.4.0, 0.3.11, 0.3.8, 0.3.4, 0.3.3, 0.3.2, 0.3.1 , 0.3.0, 0.2.1, 0.2.0,# 0.1.0 [master repo]
3, the server to obtain the bundle way:
NSString *urlstring = @ "Nsurl *jscodelocation = [Nsurl urlwithstring:urlstring]; Rctrootview *rootview = [[Rctrootview alloc] initwithbundleurl:jscodelocation modulename:@ "DemoView" Initialproperties:nil Launchoptions:nil];
4, according to the offline version of the server to obtain bundle mode:
Nsurl *jscodelocation = [[NSBundle mainbundle] urlforresource:@ "DemoView" withextension:@ "Jsbundle"]; Rctrootview *rootview = [[Rctrootview alloc] initwithbundleurl:jscodelocation modulename:@ "DemoView" Initialproperties:nil Launchoptions:nil];
5, according to the service side to generate bundle mode:
Curl ' Http://localhost:8081/demo/DemoView.ios.bundle?platform=ios '-o demoview.jsbundle
Other questions are slowly iterated over later.
Existing iOS project integration reactnative record documentation