ExceptionsManager.js:61无法读取属性'getCurrentPosition'的未定
ExceptionsManager.js:61 Cannot read property 'getCurrentPosition' of undefined
当我尝试运行Facebook的地理位置示例时,我得到了错误:红色屏幕上的Cannot read property 'getCurrentPosition' of undefined
。当我刚加载地图视图并将follow用户属性设置为TRUE时,gps在模拟器中正常工作。
知道发生了什么事吗?
听起来RCTLocationObserver
是未定义的,这意味着RCTGeolocation
可能没有正确链接。
您需要在生成设置中链接到它,如下所示:https://github.com/facebook/react-native/issues/197
或者,如果您正在使用CocoaPods,请将其添加到您的Podfile中。
有一些可能。在我的案例中,我在同一个文件中使用了Navigator组件,导入它似乎会覆盖navigator
全局。尝试记录navigator
并查看其上设置了哪些属性。
如果你看到"ProxyComponent"和与手势相关的东西,你和我一样,在navigator文件之外进行navigator.geolocation调用将解决问题。