1.React-Native run in ios
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error in config:
[Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier /Users/xiaotian/Desktop/ZhiHuDaily-React-Native-master/ios/build/Build/Products/Debug-iphonesimulator/RCTZhiHuDaily.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
]
解决方法:
1、reset一下 ios模拟器
2、terminal中执行, react-native upgrade 一直enter!
3. 还是不行的话,先用xcode运行项目
2.Home.getInitialState():must return an object or null
解决方法:
1.getinitialstate方法里没有初始化变量,或者在异步请求服务器数据之后才初始化变量,导致下面用到变量时根本就没有这个变量
。变量初始化一个null或在移步执行之前先初始化一个null
3.模拟器command r 没反应
shift+command+k
4,react-packager has encountered an internal error
1>终端brew upgrade watchman
2>xcode 里clean
5.react-native android 真机测试报错 no devices has found,找不到机器
1>.获取设备的厂商id
2>.vi ~/.android/adb_usb.ini 加上厂商id
3>重启Mac
6.View` has no propType for native prop `RCTView.alignContent` of native type `YGAlign`
解决:1>关闭当前packager server(可能是别的项目的,所以会报错)解决:关闭当前packager server(可能是别的项目的,所以会报错)
2> 开启当前项目对应的packager server
7.Element type is invalid: expected a string (for build-in components) check of App
本人用redux框架,在page链接redux对应的state和action时,connect函数忘了写connect函数名了... 加上connect->ok!
export default connect (state => ({
state: state.dynamic
}),
(dispatch) => ({
actions:bindActionCreators(dynamicActions, dispatch)
})
)(Main);
总之这个错误,是没有正确返回组件
8.the development server returned response error code:500
原因:
import App from'./src';
AppRegistry.registerComponent('shitoujiandaobu', () => App);
显然是App路径错了
解决:
import App from'./src/app';
AppRegistry.registerComponent('shitoujiandaobu', () => App);
9.null is not an object(evaluating'_this2.onPress')
问题:this指向问题 指向的对象没有onPress方法为null
解决:记得查找每个调用方法有没有绑定this
renderRow={this.renderRow}改成:
renderRow={this.renderRow.bind(this)}
10.listview renderheader死活不显示
解决:改成renderfooter,再改回来!!!,这个问题简直奇葩!!!
网友评论