React Native Fetch Blob - undefined is not an object (evaluating #39;RNFetchBlob.DocumentDir#39;)(React Native Fetch Blob - 未定义不是对象(评估RNFetchBlob.DocumentDir))
问题描述
我已经查看了 wiki 的故障排除页面,但我仍然无法解决我遇到的问题.
I have looked at the trouble shooting page of the wiki, however I still cannot fix the problem I am having.
react-native-cli: 2.0.1
react-native: 0.43.4
我的代码:
从react-native-file-uploader"导入 FileUploader
和
<Button
onPress={() => RNFetchBlob.fetch('POST', 'http://localhost:8000/upload', {
'Content-Type' : 'application/octet-stream'
}, RNFetchBlob.wrap('./tempImageStore/image.jpg'))
}
title={'Upload File'}
/>
我得到的错误:
1) npm install --save github:wkh237/react-native-fetch-blob-package#master
2) react-native 链接
- 我尝试使用
import RNFetchBlob from 'react-native-fetch-blob'和var RNFetchBlob = require('react-native-fetch-blob').default 来导入它 - 我已尝试使用上述代码以及
npm install --save react-native-fetch-blob 安装它 - 我正在 IOS 模拟器上尝试这个.
- I have tried importing it with both
import RNFetchBlob from 'react-native-fetch-blob'andvar RNFetchBlob = require('react-native-fetch-blob').default - I have tried installing it with the above code and also with
npm install --save react-native-fetch-blob - I am trying this on the IOS emulator.
提前感谢您的帮助!
推荐答案
所以看起来模块没有导入.很明显,我知道,我只能想到几件事来帮助查看,因为该项目看起来相当流行且稳定.
So it looks like the module isn't importing. Obvious I know, I can only think of a few things to help seeing as that project looks fairly popular and stable.
我注意到您需要react-native-file-uploader"但使用react-native-fetch-blob".我假设这是一个错误.如果你还没有,你也可以试试:
I noticed that you're requiring 'react-native-file-uploader' but using 'react-native-fetch-blob'. I'm assuming this is a mistake. You could also try, if you haven't:
var RNFetchBlob = require('react-native-fetch-blob')
现在假设您正确导入它,请尝试以下操作之一,然后重新启动 x-code:
Now assuming you're correctly importing it, try one of the following and then restart x-code:
如果您还没有重新启动打包程序.我记得每次安装新模块时都必须重新启动打包程序.
If you haven't already restart the packager. I recall having to restart the packager every time I installed a new module.
如果这不起作用,请尝试安装从您的节点模块中删除它(为了安全起见)并使用可可豆荚进行安装,它将为您处理所有链接.
If that doesn't work, try installing deleting it from your node modules (just to be safe) and installing with cocoa pods which will handle all of the linking for you.
这篇关于React Native Fetch Blob - 未定义不是对象(评估'RNFetchBlob.DocumentDir')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:React Native Fetch Blob - 未定义不是对象(评估'RNFetchBlob.DocumentDir')
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
