import AliyunOSS from 'aliyun-oss-react-native';
AliyunOSS.initWithSecurityToken(STSConfig.SecurityToken,STSConfig.AccessKeyId,STSConfig.SecretKeyId,endPoint,configuration); //《〈==network Error?
const saveOSS = async (bucket_name, objkey, filePath) => {
return (new Promise((resolve) => {
AliyunOSS.asyncUpload(bucket_name, objkey, filePath).then( (res) => {
//console.log("Success : ", res);
resolve(true);
}).catch((error)=>{
setTimeout(()=> {
AliyunOSS.asyncUpload(bucket_name, objkey, filePath).then((res) => {
//console.log("Success : ", res);
resolve(true);
}).catch((error)=>{
resolve(false);
})
}, 20);
})
}));
};
应用是RN 0.66。 以下是code。保存image在安卓手机上总是在进行中,也不出错。怀疑是Init有network错误。App已经允许http
android:usesCleartextTraffic="true"如何fix这个问题?