We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在taro.js 框架中使用,模板是react native 调用任何api,都会报
TypeError: null is not an object (evaluating 'AliOss.enableDevMode')
比如这样
//文件上传 function upload() { console.log("准备上传") //open log console.log(AliyunOSS); if (AliyunOSS) { AliyunOSS.enableDevMode() //报错 // defalut configraiton const configuration = { maxRetryCount: 3, timeoutIntervalForRequest: 30, timeoutIntervalForResource: 24 * 60 * 60 }; const key = '1' const secret = '2' const endpoint = "https://oss-cn-shenzhen.aliyuncs.com" AliyunOSS.initWithPlainTextAccessKey(key, secret, endpoint, configuration); AliyunOSS.asyncUpload('jimuku', 'app', album[0]).then(res => { console.log(res); }).catch(err => { console.log(err); }) } }
The text was updated successfully, but these errors were encountered:
是不是方法不对,有没有示例demo,谢谢
Sorry, something went wrong.
源码中找到的示范
export default function App() { const [result, setResult] = React.useState<number | undefined>(); React.useEffect(() => { // AliyunOSS.initWithSecurityToken(); // AliyunOSS.asyncUpload(); }, []);
然后这样写
export default function Publish() { useEffect(() => { const configuration = { maxRetryCount: 3, timeoutIntervalForRequest: 30, timeoutIntervalForResource: 24 * 60 * 60 }; const key = '' const secret = '' const endpoint = "https://oss-cn-shenzhen.aliyuncs.com" AliyunOSS.initWithSecurityToken(key, secret, endpoint, configuration); }, [])
错误如下:
ERROR TypeError: null is not an object (evaluating 'AliOss.initWithSecurityToken')
key 和 secret是阿里提供的,不能为空。
key
secret
No branches or pull requests
在taro.js 框架中使用,模板是react native
调用任何api,都会报
比如这样
The text was updated successfully, but these errors were encountered: